LinkTitles extension for MediaWiki
Automatically add links to existing pages.
All Classes Namespaces Functions Variables Modules Pages
Config.php
1 <?php
23 namespace LinkTitles;
24 
37 class Config {
42  public $parseOnEdit;
43 
49 
55 
61 
69  public $blackList;
70 
77 
84 
90  public $firstOnly;
91 
98  public $smartMode;
99 
106 
118 
129  public $wordEndOnly;
130 
137 
143 
151 
159 
164  public $specialPageReloadAfter;
165 
171 
176  private $dbType;
177 
178  public $enableConsoleOutput;
179  public $enableDebugConsoleOutput;
180 
186  public function sqliteDatabase() {
187  return $this->dbType === 'sqlite';
188  }
189 
196  public function __construct() {
197  global $wgLinkTitlesParseOnEdit;
198  global $wgLinkTitlesParseOnRender;
199  global $wgLinkTitlesPreferShortTitles;
200  global $wgLinkTitlesMinimumTitleLength;
201  global $wgLinkTitlesBlackList;
202  global $wgLinkTitlesSourceNamespaces;
203  global $wgLinkTitlesTargetNamespaces;
204  global $wgLinkTitlesSameNamespace;
205  global $wgLinkTitlesFirstOnly;
206  global $wgLinkTitlesSmartMode;
207  global $wgCapitalLinks;
208  global $wgLinkTitlesWordStartOnly;
209  global $wgLinkTitlesWordEndOnly;
210  global $wgLinkTitlesSkipTemplates;
211  global $wgLinkTitlesParseHeadings;
212  global $wgLinkTitlesEnableNoTargetMagicWord;
213  global $wgLinkTitlesCheckRedirect;
214  global $wgLinkTitlesSpecialPageReloadAfter;
215  global $wgDBtype;
216  $this->parseOnEdit = $wgLinkTitlesParseOnEdit;
217  $this->parseOnRender = $wgLinkTitlesParseOnRender;
218  $this->preferShortTitles = $wgLinkTitlesPreferShortTitles;
219  $this->minimumTitleLength = $wgLinkTitlesMinimumTitleLength;
220  $this->blackList = $wgLinkTitlesBlackList;
221  $this->sourceNamespaces = $wgLinkTitlesSourceNamespaces ? $wgLinkTitlesSourceNamespaces : [ NS_MAIN ];
222  $this->targetNamespaces = $wgLinkTitlesTargetNamespaces;
223  $this->sameNamespace = $wgLinkTitlesSameNamespace;
224  $this->firstOnly = $wgLinkTitlesFirstOnly;
225  $this->smartMode = $wgLinkTitlesSmartMode;
226  $this->capitalLinks = $wgCapitalLinks; // MediaWiki global variable
227  $this->wordStartOnly = $wgLinkTitlesWordStartOnly;
228  $this->wordEndOnly = $wgLinkTitlesWordEndOnly;
229  $this->skipTemplates = $wgLinkTitlesSkipTemplates;
230  $this->parseHeadings = $wgLinkTitlesParseHeadings;
231  $this->enableNoTargetMagicWord = $wgLinkTitlesEnableNoTargetMagicWord;;
232  $this->checkRedirect = $wgLinkTitlesCheckRedirect;;
233  $this->specialPageReloadAfter = $wgLinkTitlesSpecialPageReloadAfter;
234  $this->enableConsoleOutput = false;
235  $this->enableDebugConsoleOutput = false;
236  $this->dbType = $wgDBtype;
237  }
238 }
$checkRedirect
Whether to check if a potential target page links back to the source page.
Definition: Config.php:150
$sameNamespace
Whether to link to pages in the same namespace (default is true).
Definition: Config.php:170
__construct()
Constructs a new Config object.
Definition: Config.php:196
$minimumTitleLength
Minimum length of a page title for it to qualify as a potential link target.
Definition: Config.php:60
$parseOnEdit
Whether to add links to a page when the page is edited/saved.
Definition: Config.php:42
$parseOnRender
Whether to add links to a page when the page is rendered.
Definition: Config.php:48
$dbType
Caches the global $wgDBtype variable.
Definition: Config.php:176
$preferShortTitles
Indicates whether to prioritize short over long titles.
Definition: Config.php:54
$firstOnly
Indicates whether to add a link to the first occurrence of a page title only (true), or add links to all occurrences on the source page (false).
Definition: Config.php:90
$parseHeadings
Whether or not to parse headings.
Definition: Config.php:142
$skipTemplates
Whether or not to skip templates.
Definition: Config.php:136
$capitalLinks
Mirrors the global MediaWiki variable $wgCapitalLinks that indicates whether or not page titles are f...
Definition: Config.php:105
$enableNoTargetMagicWord
Whether to enable the NOAUTOLINKTARGET magic word which prevents a potential target page from being l...
Definition: Config.php:158
$wordStartOnly
Whether or not to link to pages only if the page title appears at the start of a word on the target p...
Definition: Config.php:117
$targetNamespaces
Array of those namespaces (integer constants) whose pages may be linked to a source page...
Definition: Config.php:83
$sourceNamespaces
Array of those namespaces (integer constants) whose pages may be linked when edited.
Definition: Config.php:76
Holds LinkTitles configuration.
Definition: Config.php:37
The LinkTitles class holds configuration for the LinkTitles extension.
Definition: Config.php:23
$smartMode
Indicates whether to operate in smart mode, i.e.
Definition: Config.php:98
sqliteDatabase()
Determines whether the MediaWiki database is SQLITE by inspecting the $wgDBtype variable (which is ca...
Definition: Config.php:186
$wordEndOnly
Whether or not to link to pages only if the page title appears at the end of a word on the target pag...
Definition: Config.php:129
$blackList
Array of page titles that must never be link targets.
Definition: Config.php:69