+ return $this->getResult()->addValue( 'query', $property, $data );
+ }
+
+ protected function appendFileExtensions( $property ) {
+ global $wgFileExtensions;
+
+ $data = array();
+ foreach ( $wgFileExtensions as $ext ) {
+ $data[] = array( 'ext' => $ext );
+ }
+ $this->getResult()->setIndexedTagName( $data, 'fe' );
+ return $this->getResult()->addValue( 'query', $property, $data );
+ }
+
+ protected function appendExtensions( $property ) {
+ global $wgExtensionCredits;
+ $data = array();
+ foreach ( $wgExtensionCredits as $type => $extensions ) {
+ foreach ( $extensions as $ext ) {
+ $ret = array();
+ $ret['type'] = $type;
+ if ( isset( $ext['name'] ) ) {
+ $ret['name'] = $ext['name'];
+ }
+ if ( isset( $ext['description'] ) ) {
+ $ret['description'] = $ext['description'];
+ }
+ if ( isset( $ext['descriptionmsg'] ) ) {
+ // Can be a string or array( key, param1, param2, ... )
+ if ( is_array( $ext['descriptionmsg'] ) ) {
+ $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
+ $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
+ $this->getResult()->setIndexedTagName( $ret['descriptionmsgparams'], 'param' );
+ } else {
+ $ret['descriptionmsg'] = $ext['descriptionmsg'];
+ }
+ }
+ if ( isset( $ext['author'] ) ) {
+ $ret['author'] = is_array( $ext['author'] ) ?
+ implode( ', ', $ext['author' ] ) : $ext['author'];
+ }
+ if ( isset( $ext['url'] ) ) {
+ $ret['url'] = $ext['url'];
+ }
+ if ( isset( $ext['version'] ) ) {
+ $ret['version'] = $ext['version'];
+ } elseif ( isset( $ext['svn-revision'] ) &&
+ preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
+ $ext['svn-revision'], $m ) )
+ {
+ $ret['version'] = 'r' . $m[1];
+ }
+ $data[] = $ret;
+ }
+ }
+
+ $this->getResult()->setIndexedTagName( $data, 'ext' );
+ return $this->getResult()->addValue( 'query', $property, $data );
+ }
+
+
+ protected function appendRightsInfo( $property ) {
+ global $wgRightsPage, $wgRightsUrl, $wgRightsText;
+ $title = Title::newFromText( $wgRightsPage );
+ $url = $title ? $title->getFullURL() : $wgRightsUrl;
+ $text = $wgRightsText;
+ if ( !$text && $title ) {
+ $text = $title->getPrefixedText();
+ }
+
+ $data = array(
+ 'url' => $url ? $url : '',
+ 'text' => $text ? $text : ''
+ );
+
+ return $this->getResult()->addValue( 'query', $property, $data );
+ }
+
+ public function appendLanguages( $property ) {
+ $data = array();
+ foreach ( Language::getLanguageNames() as $code => $name ) {
+ $lang = array( 'code' => $code );
+ ApiResult::setContent( $lang, $name );
+ $data[] = $lang;
+ }
+ $this->getResult()->setIndexedTagName( $data, 'lang' );
+ return $this->getResult()->addValue( 'query', $property, $data );