MediaWiki REL1_28
InstallDocFormatter.php
Go to the documentation of this file.
1<?php
24 static function format( $text ) {
25 $obj = new self( $text );
26
27 return $obj->execute();
28 }
29
30 protected function __construct( $text ) {
31 $this->text = $text;
32 }
33
34 protected function execute() {
35 $text = $this->text;
36 // Use Unix line endings, escape some wikitext stuff
37 $text = str_replace( [ '<', '{{', '[[', '__', "\r" ],
38 [ '&lt;', '&#123;&#123;', '&#91;&#91;', '&#95;&#95;', '' ], $text );
39 // join word-wrapped lines into one
40 do {
41 $prev = $text;
42 $text = preg_replace( "/\n([\\*#\t])([^\n]*?)\n([^\n#\\*:]+)/", "\n\\1\\2 \\3", $text );
43 } while ( $text != $prev );
44 // Replace tab indents with colons
45 $text = preg_replace( '/^\t\t/m', '::', $text );
46 $text = preg_replace( '/^\t/m', ':', $text );
47
48 $linkStart = '<span class="config-plainlink">[';
49 $linkEnd = ' $0]</span>';
50
51 // turn (Tnnnn) into links
52 $text = preg_replace(
53 '/T\d+/',
54 "{$linkStart}https://phabricator.wikimedia.org/$0{$linkEnd}",
55 $text
56 );
57
58 // turn (bug nnnn) into links
59 $text = preg_replace(
60 '/bug (\d+)/',
61 "{$linkStart}https://bugzilla.wikimedia.org/$1{$linkEnd}",
62 $text
63 );
64
65 // add links to manual to every global variable mentioned
66 $text = preg_replace(
67 '/\$wg[a-z0-9_]+/i',
68 "{$linkStart}https://www.mediawiki.org/wiki/Manual:$0{$linkEnd}",
69 $text
70 );
71
72 return $text;
73 }
74}
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition design.txt:18
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:37