MediaWiki  1.27.2
ApiOpenSearch.php
Go to the documentation of this file.
1 <?php
28 
32 class ApiOpenSearch extends ApiBase {
33 
34  private $format = null;
35  private $fm = null;
36 
42  protected function getFormat() {
43  if ( $this->format === null ) {
44  $params = $this->extractRequestParams();
45  $format = $params['format'];
46 
47  $allowedParams = $this->getAllowedParams();
48  if ( !in_array( $format, $allowedParams['format'][ApiBase::PARAM_TYPE] ) ) {
49  $format = $allowedParams['format'][ApiBase::PARAM_DFLT];
50  }
51 
52  if ( substr( $format, -2 ) === 'fm' ) {
53  $this->format = substr( $format, 0, -2 );
54  $this->fm = 'fm';
55  } else {
56  $this->format = $format;
57  $this->fm = '';
58  }
59  }
60  return $this->format;
61  }
62 
63  public function getCustomPrinter() {
64  switch ( $this->getFormat() ) {
65  case 'json':
66  return new ApiOpenSearchFormatJson(
67  $this->getMain(), $this->fm, $this->getParameter( 'warningsaserror' )
68  );
69 
70  case 'xml':
71  $printer = $this->getMain()->createPrinterByName( 'xml' . $this->fm );
72  $printer->setRootElement( 'SearchSuggestion' );
73  return $printer;
74 
75  default:
76  ApiBase::dieDebug( __METHOD__, "Unsupported format '{$this->getFormat()}'" );
77  }
78  }
79 
80  public function execute() {
81  $params = $this->extractRequestParams();
82  $search = $params['search'];
83  $limit = $params['limit'];
84  $namespaces = $params['namespace'];
85  $suggest = $params['suggest'];
86 
87  if ( $params['redirects'] === null ) {
88  // Backwards compatibility, don't resolve for JSON.
89  $resolveRedir = $this->getFormat() !== 'json';
90  } else {
91  $resolveRedir = $params['redirects'] === 'resolve';
92  }
93 
94  $results = [];
95 
96  if ( !$suggest || $this->getConfig()->get( 'EnableOpenSearchSuggest' ) ) {
97  // Open search results may be stored for a very long time
98  $this->getMain()->setCacheMaxAge( $this->getConfig()->get( 'SearchSuggestCacheExpiry' ) );
99  $this->getMain()->setCacheMode( 'public' );
100  $this->search( $search, $limit, $namespaces, $resolveRedir, $results );
101 
102  // Allow hooks to populate extracts and images
103  Hooks::run( 'ApiOpenSearchSuggest', [ &$results ] );
104 
105  // Trim extracts, if necessary
106  $length = $this->getConfig()->get( 'OpenSearchDescriptionLength' );
107  foreach ( $results as &$r ) {
108  if ( is_string( $r['extract'] ) && !$r['extract trimmed'] ) {
109  $r['extract'] = self::trimExtract( $r['extract'], $length );
110  }
111  }
112  }
113 
114  // Populate result object
115  $this->populateResult( $search, $results );
116  }
117 
127  protected function search( $search, $limit, $namespaces, $resolveRedir, &$results ) {
128  $searchEngine = MediaWikiServices::getInstance()->newSearchEngine();
129  $searchEngine->setLimitOffset( $limit );
130  $searchEngine->setNamespaces( $namespaces );
131  $titles = $searchEngine->extractTitles( $searchEngine->completionSearchWithVariants( $search ) );
132 
133  if ( !$titles ) {
134  return;
135  }
136 
137  // Special pages need unique integer ids in the return list, so we just
138  // assign them negative numbers because those won't clash with the
139  // always positive articleIds that non-special pages get.
140  $nextSpecialPageId = -1;
141 
142  if ( $resolveRedir ) {
143  // Query for redirects
144  $redirects = [];
145  $lb = new LinkBatch( $titles );
146  if ( !$lb->isEmpty() ) {
147  $db = $this->getDB();
148  $res = $db->select(
149  [ 'page', 'redirect' ],
150  [ 'page_namespace', 'page_title', 'rd_namespace', 'rd_title' ],
151  [
152  'rd_from = page_id',
153  'rd_interwiki IS NULL OR rd_interwiki = ' . $db->addQuotes( '' ),
154  $lb->constructSet( 'page', $db ),
155  ],
156  __METHOD__
157  );
158  foreach ( $res as $row ) {
159  $redirects[$row->page_namespace][$row->page_title] =
160  [ $row->rd_namespace, $row->rd_title ];
161  }
162  }
163 
164  // Bypass any redirects
165  $seen = [];
166  foreach ( $titles as $title ) {
167  $ns = $title->getNamespace();
168  $dbkey = $title->getDBkey();
169  $from = null;
170  if ( isset( $redirects[$ns][$dbkey] ) ) {
171  list( $ns, $dbkey ) = $redirects[$ns][$dbkey];
172  $from = $title;
173  $title = Title::makeTitle( $ns, $dbkey );
174  }
175  if ( !isset( $seen[$ns][$dbkey] ) ) {
176  $seen[$ns][$dbkey] = true;
177  $resultId = $title->getArticleID();
178  if ( $resultId === 0 ) {
179  $resultId = $nextSpecialPageId;
180  $nextSpecialPageId -= 1;
181  }
182  $results[$resultId] = [
183  'title' => $title,
184  'redirect from' => $from,
185  'extract' => false,
186  'extract trimmed' => false,
187  'image' => false,
188  'url' => wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ),
189  ];
190  }
191  }
192  } else {
193  foreach ( $titles as $title ) {
194  $resultId = $title->getArticleID();
195  if ( $resultId === 0 ) {
196  $resultId = $nextSpecialPageId;
197  $nextSpecialPageId -= 1;
198  }
199  $results[$resultId] = [
200  'title' => $title,
201  'redirect from' => null,
202  'extract' => false,
203  'extract trimmed' => false,
204  'image' => false,
205  'url' => wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ),
206  ];
207  }
208  }
209  }
210 
215  protected function populateResult( $search, &$results ) {
216  $result = $this->getResult();
217 
218  switch ( $this->getFormat() ) {
219  case 'json':
220  // http://www.opensearch.org/Specifications/OpenSearch/Extensions/Suggestions/1.1
221  $result->addArrayType( null, 'array' );
222  $result->addValue( null, 0, strval( $search ) );
223  $terms = [];
224  $descriptions = [];
225  $urls = [];
226  foreach ( $results as $r ) {
227  $terms[] = $r['title']->getPrefixedText();
228  $descriptions[] = strval( $r['extract'] );
229  $urls[] = $r['url'];
230  }
231  $result->addValue( null, 1, $terms );
232  $result->addValue( null, 2, $descriptions );
233  $result->addValue( null, 3, $urls );
234  break;
235 
236  case 'xml':
237  // http://msdn.microsoft.com/en-us/library/cc891508%28v=vs.85%29.aspx
238  $imageKeys = [
239  'source' => true,
240  'alt' => true,
241  'width' => true,
242  'height' => true,
243  'align' => true,
244  ];
245  $items = [];
246  foreach ( $results as $r ) {
247  $item = [
248  'Text' => $r['title']->getPrefixedText(),
249  'Url' => $r['url'],
250  ];
251  if ( is_string( $r['extract'] ) && $r['extract'] !== '' ) {
252  $item['Description'] = $r['extract'];
253  }
254  if ( is_array( $r['image'] ) && isset( $r['image']['source'] ) ) {
255  $item['Image'] = array_intersect_key( $r['image'], $imageKeys );
256  }
257  ApiResult::setSubelementsList( $item, array_keys( $item ) );
258  $items[] = $item;
259  }
260  ApiResult::setIndexedTagName( $items, 'Item' );
261  $result->addValue( null, 'version', '2.0' );
262  $result->addValue( null, 'xmlns', 'http://opensearch.org/searchsuggest2' );
263  $result->addValue( null, 'Query', strval( $search ) );
264  $result->addSubelementsList( null, 'Query' );
265  $result->addValue( null, 'Section', $items );
266  break;
267 
268  default:
269  ApiBase::dieDebug( __METHOD__, "Unsupported format '{$this->getFormat()}'" );
270  }
271  }
272 
273  public function getAllowedParams() {
274  return [
275  'search' => null,
276  'limit' => [
277  ApiBase::PARAM_DFLT => $this->getConfig()->get( 'OpenSearchDefaultLimit' ),
278  ApiBase::PARAM_TYPE => 'limit',
279  ApiBase::PARAM_MIN => 1,
280  ApiBase::PARAM_MAX => 100,
281  ApiBase::PARAM_MAX2 => 100
282  ],
283  'namespace' => [
285  ApiBase::PARAM_TYPE => 'namespace',
287  ],
288  'suggest' => false,
289  'redirects' => [
290  ApiBase::PARAM_TYPE => [ 'return', 'resolve' ],
291  ],
292  'format' => [
293  ApiBase::PARAM_DFLT => 'json',
294  ApiBase::PARAM_TYPE => [ 'json', 'jsonfm', 'xml', 'xmlfm' ],
295  ],
296  'warningsaserror' => false,
297  ];
298  }
299 
300  protected function getExamplesMessages() {
301  return [
302  'action=opensearch&search=Te'
303  => 'apihelp-opensearch-example-te',
304  ];
305  }
306 
307  public function getHelpUrls() {
308  return 'https://www.mediawiki.org/wiki/API:Opensearch';
309  }
310 
321  public static function trimExtract( $text, $length ) {
322  static $regex = null;
323 
324  if ( $regex === null ) {
325  $endchars = [
326  '([^\d])\.\s', '\!\s', '\?\s', // regular ASCII
327  '。', // full-width ideographic full-stop
328  '.', '!', '?', // double-width roman forms
329  '。', // half-width ideographic full stop
330  ];
331  $endgroup = implode( '|', $endchars );
332  $end = "(?:$endgroup)";
333  $sentence = ".{{$length},}?$end+";
334  $regex = "/^($sentence)/u";
335  }
336 
337  $matches = [];
338  if ( preg_match( $regex, $text, $matches ) ) {
339  return trim( $matches[1] );
340  } else {
341  // Just return the first line
342  return trim( explode( "\n", $text )[0] );
343  }
344  }
345 
353  public static function getOpenSearchTemplate( $type ) {
354  $config = MediaWikiServices::getInstance()->getSearchEngineConfig();
355  $template = $config->getConfig()->get( 'OpenSearchTemplate' );
356 
357  if ( $template && $type === 'application/x-suggestions+json' ) {
358  return $template;
359  }
360 
361  $ns = implode( '|', $config->defaultNamespaces() );
362  if ( !$ns ) {
363  $ns = '0';
364  }
365 
366  switch ( $type ) {
367  case 'application/x-suggestions+json':
368  return $config->getConfig()->get( 'CanonicalServer' ) . wfScript( 'api' )
369  . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
370 
371  case 'application/x-suggestions+xml':
372  return $config->getConfig()->get( 'CanonicalServer' ) . wfScript( 'api' )
373  . '?action=opensearch&format=xml&search={searchTerms}&namespace=' . $ns;
374 
375  default:
376  throw new MWException( __METHOD__ . ": Unknown type '$type'" );
377  }
378  }
379 }
380 
382  private $warningsAsError = false;
383 
384  public function __construct( ApiMain $main, $fm, $warningsAsError ) {
385  parent::__construct( $main, "json$fm" );
386  $this->warningsAsError = $warningsAsError;
387  }
388 
389  public function execute() {
390  if ( !$this->getResult()->getResultData( 'error' ) ) {
391  $result = $this->getResult();
392 
393  // Ignore warnings or treat as errors, as requested
394  $warnings = $result->removeValue( 'warnings', null );
395  if ( $this->warningsAsError && $warnings ) {
396  $this->dieUsage(
397  'Warnings cannot be represented in OpenSearch JSON format', 'warnings', 0,
398  [ 'warnings' => $warnings ]
399  );
400  }
401 
402  // Ignore any other unexpected keys (e.g. from $wgDebugToolbar)
403  $remove = array_keys( array_diff_key(
404  $result->getResultData(),
405  [ 0 => 'search', 1 => 'terms', 2 => 'descriptions', 3 => 'urls' ]
406  ) );
407  foreach ( $remove as $key ) {
408  $result->removeValue( $key, null );
409  }
410  }
411 
412  parent::execute();
413  }
414 }
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Definition: ApiBase.php:88
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
getResult()
Get the result object.
Definition: ApiBase.php:584
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
search($search, $limit, $namespaces, $resolveRedir, &$results)
Perform the search.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
getParameter($paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:709
$batch execute()
const NS_MAIN
Definition: Defines.php:69
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
getMain()
Get the main module.
Definition: ApiBase.php:480
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:50
__construct(ApiMain $main, $fm, $warningsAsError)
populateResult($search, &$results)
getDB()
Gets a default slave database connection object.
Definition: ApiBase.php:612
getResultData()
Get the result data array (read-only)
Definition: ApiBase.php:2967
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:91
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
Definition: ApiBase.php:685
const PROTO_CURRENT
Definition: Defines.php:264
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
static trimExtract($text, $length)
Trim an extract to a sensible length.
wfExpandUrl($url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:618
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1796
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
Definition: hooks.txt:762
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:31
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1798
$res
Definition: database.txt:21
getFormat()
Get the output format.
getConfig()
Get the Config object.
$params
This is the main API class, used for both external and internal processing.
Definition: ApiMain.php:41
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
Definition: ApiBase.php:97
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:912
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes...
Definition: ApiResult.php:567
$from
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:53
dieUsage($description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
Definition: ApiBase.php:1526
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1004
This abstract class implements many basic API functions, and is the base of all API classes...
Definition: ApiBase.php:39
API JSON output formatter.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:100
static dieDebug($method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2230
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2338
static & makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:524
static getOpenSearchTemplate($type)
Fetch the template for a type.
if the prop value should be in the metadata multi language array format
Definition: hooks.txt:1473
$matches