protected $mProfiler;
/**
- * @var \MediaWiki\Linker\LinkRenderer
+ * @var LinkRenderer
*/
protected $mLinkRenderer;
}
/**
- * Get a \MediaWiki\Linker\LinkRenderer instance to make links with
+ * Get a LinkRenderer instance to make links with
*
* @since 1.28
- * @return \MediaWiki\Linker\LinkRenderer
+ * @return LinkRenderer
*/
public function getLinkRenderer() {
if ( !$this->mLinkRenderer ) {
} elseif ( isset( $m[5] ) && $m[5] !== '' ) {
# RFC or PMID
if ( substr( $m[0], 0, 3 ) === 'RFC' ) {
+ if ( !$this->mOptions->getMagicRFCLinks() ) {
+ return $m[0];
+ }
$keyword = 'RFC';
$urlmsg = 'rfcurl';
$cssClass = 'mw-magiclink-rfc';
$id = $m[5];
} elseif ( substr( $m[0], 0, 4 ) === 'PMID' ) {
+ if ( !$this->mOptions->getMagicPMIDLinks() ) {
+ return $m[0];
+ }
$keyword = 'PMID';
$urlmsg = 'pubmedurl';
$cssClass = 'mw-magiclink-pmid';
}
$url = wfMessage( $urlmsg, $id )->inContentLanguage()->text();
return Linker::makeExternalLink( $url, "{$keyword} {$id}", true, $cssClass, [], $this->mTitle );
- } elseif ( isset( $m[6] ) && $m[6] !== '' ) {
+ } elseif ( isset( $m[6] ) && $m[6] !== ''
+ && $this->mOptions->getMagicISBNLinks()
+ ) {
# ISBN
$isbn = $m[6];
$space = self::SPACE_NOT_NL; # non-newline space
* Replace external links (REL)
*
* Note: this is all very hackish and the order of execution matters a lot.
- * Make sure to run tests/parserTests.php if you change this code.
+ * Make sure to run tests/parser/parserTests.php if you change this code.
*
* @private
*
$pageId = $title->getArticleID();
$revId = $title->getLatestRevID();
- $rev = Revision::newKnownCurrent( wfGetDB( DB_SLAVE ), $pageId, $revId );
+ $rev = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $pageId, $revId );
if ( $rev ) {
$rev->setTitle( $title );
}
*/
public function fetchScaryTemplateMaybeFromCache( $url ) {
global $wgTranscludeCacheExpiry;
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$tsCond = $dbr->timestamp( time() - $wgTranscludeCacheExpiry );
$obj = $dbr->selectRow( 'transcache', [ 'tc_time', 'tc_contents' ],
[ 'tc_url' => $url, "tc_time >= " . $dbr->addQuotes( $tsCond ) ] );
* @return string
*/
public function extensionSubstitution( $params, $frame ) {
+ static $errorStr = '<span class="error">';
+ static $errorLen = 20;
+
$name = $frame->expand( $params['name'] );
+ if ( substr( $name, 0, $errorLen ) === $errorStr ) {
+ // Probably expansion depth or node count exceeded. Just punt the
+ // error up.
+ return $name;
+ }
+
$attrText = !isset( $params['attr'] ) ? null : $frame->expand( $params['attr'] );
+ if ( substr( $attrText, 0, $errorLen ) === $errorStr ) {
+ // See above
+ return $attrText;
+ }
+
$content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] );
+ if ( substr( $content, 0, $errorLen ) === $errorStr ) {
+ // See above
+ return $content;
+ }
+
$marker = self::MARKER_PREFIX . "-$name-"
. sprintf( '%08X', $this->mMarkerIndex++ ) . self::MARKER_SUFFIX;
$output = "<$name$attrText/>";
} else {
$close = is_null( $params['close'] ) ? '' : $frame->expand( $params['close'] );
+ if ( substr( $close, 0, $errorLen ) === $errorStr ) {
+ // See above
+ return $close;
+ }
$output = "<$name$attrText>$content$close";
}
}
# * <b> (r105284)
# * <bdi> (bug 72884)
# * <span dir="rtl"> and <span dir="ltr"> (bug 35167)
+ # * <s> and <strike> (T35715)
# We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from <span>,
# to allow setting directionality in toc items.
$tocline = preg_replace(
[
- '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?>#',
- '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?>#'
+ '#<(?!/?(span|sup|sub|bdi|i|b|s|strike)(?: [^>]*)?>).*?>#',
+ '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b|s|strike))(?: .*?)?>#'
],
[ '', '<$1>' ],
$safeHeadline