<?php
/**
- *
- *
- * Created on May 13, 2007
- *
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
$query = $params['query'];
$protocol = ApiQueryExtLinksUsage::getProtocolPrefix( $params['protocol'] );
- $this->addFields( array(
+ $this->addFields( [
'el_from',
'el_to'
- ) );
+ ] );
$this->addTables( 'externallinks' );
$this->addWhereFld( 'el_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
$this->setContinueEnumParameter( 'offset', $offset + $params['limit'] );
break;
}
- $entry = array();
+ $entry = [];
$to = $row->el_to;
// expand protocol-relative urls
if ( $params['expandurl'] ) {
$to = wfExpandUrl( $to, PROTO_CANONICAL );
}
- ApiResult::setContent( $entry, $to );
+ ApiResult::setContentValue( $entry, 'url', $to );
$fit = $this->addPageSubItem( $row->el_from, $entry );
if ( !$fit ) {
$this->setContinueEnumParameter( 'offset', $offset + $count - 1 );
}
public function getAllowedParams() {
- return array(
- 'limit' => array(
+ return [
+ 'limit' => [
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
- ),
- 'offset' => array(
+ ],
+ 'offset' => [
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
- ),
- 'protocol' => array(
+ ],
+ 'protocol' => [
ApiBase::PARAM_TYPE => ApiQueryExtLinksUsage::prepareProtocols(),
ApiBase::PARAM_DFLT => '',
- ),
+ ],
'query' => null,
'expandurl' => false,
- );
+ ];
}
- public function getExamplesMessages() {
- return array(
+ protected function getExamplesMessages() {
+ return [
'action=query&prop=extlinks&titles=Main%20Page'
=> 'apihelp-query+extlinks-example-simple',
- );
+ ];
}
public function getHelpUrls() {
- return 'https://www.mediawiki.org/wiki/API:Properties#extlinks_.2F_el';
+ return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Extlinks';
}
}