/** * @covers Linker::formatLinksInComment * @dataProvider provideCasesForFormatLinksInComment */ public function testFormatLinksInComment($expected, $input, $wiki) { $conf = new SiteConfiguration(); $conf->settings = array('wgServer' => array('enwiki' => '//en.example.org'), 'wgArticlePath' => array('enwiki' => '/w/$1')); $conf->suffixes = array('wiki'); $this->setMwGlobals(array('wgScript' => '/wiki/index.php', 'wgArticlePath' => '/wiki/$1', 'wgWellFormedXml' => true, 'wgCapitalLinks' => true, 'wgConf' => $conf)); $this->assertEquals($expected, Linker::formatLinksInComment($input, Title::newFromText('Special:BlankPage'), false, $wiki)); }
static function formatSubject($s) { # Sanitize text a bit: $s = str_replace("\n", " ", $s); # Allow HTML entities $s = Sanitizer::escapeHtmlAllowEntities($s); # Render links: return Linker::formatLinksInComment($s, null, false); }
public function formatLinksInComment($comment, $title = null, $local = false, $wikiId = null) { return Linker::formatLinksInComment($comment, $title, $local, $wikiId); }
/** * @param $row * @return String */ private function formatBlockStatus($row) { $additionalHtml = ''; if (isset($row['blocked']) && $row['blocked']) { $flags = array(); foreach (array('anononly', 'nocreate', 'noautoblock', 'noemail', 'nousertalk') as $option) { if ($row['block-' . $option]) { $flags[] = $option; } } $flags = implode(',', $flags); $optionMessage = BlockLogFormatter::formatBlockFlags($flags, $this->getLanguage()); if ($row['block-expiry'] == 'infinity') { $text = $this->msg('centralauth-admin-blocked2-indef')->parse(); } else { $expiry = $this->getLanguage()->timeanddate($row['block-expiry'], true); $expiryd = $this->getLanguage()->date($row['block-expiry'], true); $expiryt = $this->getLanguage()->time($row['block-expiry'], true); $text = $this->msg('centralauth-admin-blocked2', $expiry, $expiryd, $expiryt)->parse(); } if ($flags) { $additionalHtml .= ' ' . $optionMessage; } if ($row['block-reason']) { $reason = Sanitizer::escapeHtmlAllowEntities($row['block-reason']); $reason = Linker::formatLinksInComment($reason, null, false, $row['wiki']); $msg = $this->msg('centralauth-admin-blocked-reason'); $msg->rawParams('<span class="plainlinks">' . $reason . '</span>'); $additionalHtml .= ' ' . $msg->parse(); } } else { $text = $this->msg('centralauth-admin-notblocked')->parse(); } return self::foreignLink($row['wiki'], 'Special:Log/block', $text, $this->msg('centralauth-admin-blocklog')->text(), 'page=User:' . urlencode($this->mUserName)) . $additionalHtml; }