Fix bug with non-latin languages.

- Fix: When $wgCapitalLinks was true, the extension would not work with non-latin languages.

Closes #7.
This commit is contained in:
Daniel Kraus
2017-08-29 06:08:30 +02:00
parent 0d8d2bfbb2
commit 1ba5a7b799
3 changed files with 4 additions and 2 deletions

View File

@ -139,7 +139,7 @@ class Target {
public function getCaseSensitiveLinkValueRegex() {
if ( $this->caseSensitiveLinkValueRegex === null ) {
$regexSafeTitle = $this->getRegexSafeTitle();
if ( $this->config->capitalLinks && ( $regexSafeTitle[0] != '\\' )) {
if ( $this->config->capitalLinks && preg_match( '/[a-zA-Z]/', $regexSafeTitle[0] ) ) {
$this->caseSensitiveLinkValueRegex = '((?i)' . $regexSafeTitle[0] . '(?-i)' . substr($regexSafeTitle, 1) . ')';
} else {
$this->caseSensitiveLinkValueRegex = '(' . $regexSafeTitle . ')';