* @see Content::replaceSection()
*/
public function replaceSection( $sectionId, Content $with, $sectionTitle = '' ) {
-
$myModelId = $this->getModel();
$sectionModelId = $with->getModel();
if ( $sectionId === 'new' ) {
# Inserting a new section
$subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' )
- ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : '';
+ ->plaintextParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : '';
if ( Hooks::run( 'PlaceNewSection', [ $this, $oldtext, $subject, &$text ] ) ) {
$text = strlen( trim( $oldtext ) ) > 0
? "{$oldtext}\n\n{$subject}{$text}"
return false;
}
- switch ( $wgArticleCountMethod ) {
- case 'any':
- return true;
- case 'comma':
- $text = $this->getNativeData();
- return strpos( $text, ',' ) !== false;
- case 'link':
- if ( $hasLinks === null ) { # not known, find out
- if ( !$title ) {
- $context = RequestContext::getMain();
- $title = $context->getTitle();
- }
-
- $po = $this->getParserOutput( $title, null, null, false );
- $links = $po->getLinks();
- $hasLinks = !empty( $links );
+ if ( $wgArticleCountMethod === 'link' ) {
+ if ( $hasLinks === null ) { # not known, find out
+ if ( !$title ) {
+ $context = RequestContext::getMain();
+ $title = $context->getTitle();
}
- return $hasLinks;
+ $po = $this->getParserOutput( $title, null, null, false );
+ $links = $po->getLinks();
+ $hasLinks = !empty( $links );
+ }
+
+ return $hasLinks;
}
- return false;
+ return true;
}
/**