* or else addWikiTextAsContent() if $interface is false.
*/
public function addWikiText( $text, $linestart = true, $interface = true ) {
+ wfDeprecated( __METHOD__, '1.32' );
$title = $this->getTitle();
if ( !$title ) {
throw new MWException( 'Title is null' );
$this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/true, /*interface*/true );
}
+ /**
+ * Convert wikitext *in the user interface language* to HTML and
+ * add it to the buffer with a `<div class="$wrapperClass">`
+ * wrapper. The result will not be language-converted, as user
+ * interface messages as already localized into a specific
+ * variant. The $text will be parsed in start-of-line context.
+ * Output will be tidy.
+ *
+ * @param string $wrapperClass The class attribute value for the <div>
+ * wrapper in the output HTML
+ * @param string $text Wikitext in the user interface language
+ * @since 1.32
+ */
+ public function wrapWikiTextAsInterface(
+ $wrapperClass, $text
+ ) {
+ $this->addWikiTextTitleInternal(
+ $text, $this->getTitle(),
+ /*linestart*/true, /*tidy*/true, /*interface*/true,
+ $wrapperClass
+ );
+ }
+
/**
* Convert wikitext *in the page content language* to HTML and add
* it to the buffer. The result with be language-converted to the
* since 1.32; all wikitext should be tidied.
* @param bool $interface Whether it is an interface message
* (for example disables conversion)
+ * @param string $wrapperClass if not empty, wraps the output in
+ * a `<div class="$wrapperClass">`
* @private
*/
private function addWikiTextTitleInternal(
- $text, Title $title, $linestart, $tidy, $interface
+ $text, Title $title, $linestart, $tidy, $interface, $wrapperClass = null
) {
global $wgParser;
+ if ( !$tidy ) {
+ wfDeprecated( 'disabling tidy', '1.32' );
+ }
+
$popts = $this->parserOptions();
$oldTidy = $popts->setTidy( $tidy );
$popts->setInterfaceMessage( (bool)$interface );
$this->addParserOutput( $parserOutput, [
'enableSectionEditLinks' => false,
- 'wrapperDivClass' => '',
+ 'wrapperDivClass' => $wrapperClass ?? '',
] );
}
!$this->haveCacheVaryCookies()
) {
if ( $config->get( 'UseESI' ) ) {
+ wfDeprecated( '$wgUseESI = true', '1.33' );
# We'll purge the proxy cache explicitly, but require end user agents
# to revalidate against the proxy on each visit.
# Surrogate-Control controls our CDN, Cache-Control downstream caches
}
} else {
$this->prepareErrorPage( $this->msg( 'permissionserrors' ) );
- $this->addWikiText( $this->formatPermissionsErrorMessage( $errors, $action ) );
+ $this->addWikiTextAsInterface( $this->formatPermissionsErrorMessage( $errors, $action ) );
}
}
*
* Is equivalent to:
*
- * $wgOut->addWikiText( "<div class='error'>\n"
+ * $wgOut->addWikiTextAsInterface( "<div class='error'>\n"
* . wfMessage( 'some-error' )->plain() . "\n</div>" );
*
* The newline after the opening div is needed in some wikitext. See T21226.
}
$s = str_replace( '$' . ( $n + 1 ), $this->msg( $name, $args )->plain(), $s );
}
- $this->addWikiText( $s );
+ $this->addWikiTextAsInterface( $s );
}
/**
* Helper function to setup the PHP implementation of OOUI to use in this request.
*
* @since 1.26
- * @param String $skinName The Skin name to determine the correct OOUI theme
- * @param String $dir Language direction
+ * @param string $skinName The Skin name to determine the correct OOUI theme
+ * @param string $dir Language direction
*/
public static function setupOOUI( $skinName = 'default', $dir = 'ltr' ) {
$themes = ResourceLoaderOOUIModule::getSkinThemeMap();