+
+ /**
+ * @since 1.29
+ */
+ protected function addLongPageWarningHeader() {
+ global $wgMaxArticleSize, $wgOut, $wgLang;
+
+ if ( $this->contentLength === false ) {
+ $this->contentLength = strlen( $this->textbox1 );
+ }
+
+ if ( $this->tooBig || $this->contentLength > $wgMaxArticleSize * 1024 ) {
+ $wgOut->wrapWikiMsg( "<div class='error' id='mw-edit-longpageerror'>\n$1\n</div>",
+ [
+ 'longpageerror',
+ $wgLang->formatNum( round( $this->contentLength / 1024, 3 ) ),
+ $wgLang->formatNum( $wgMaxArticleSize )
+ ]
+ );
+ } else {
+ if ( !$this->context->msg( 'longpage-hint' )->isDisabled() ) {
+ $wgOut->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>",
+ [
+ 'longpage-hint',
+ $wgLang->formatSize( strlen( $this->textbox1 ) ),
+ strlen( $this->textbox1 )
+ ]
+ );
+ }
+ }
+ }
+
+ /**
+ * @since 1.29
+ */
+ protected function addPageProtectionWarningHeaders() {
+ global $wgOut;
+
+ if ( $this->mTitle->isProtected( 'edit' ) &&
+ MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== [ '' ]
+ ) {
+ # Is the title semi-protected?
+ if ( $this->mTitle->isSemiProtected() ) {
+ $noticeMsg = 'semiprotectedpagewarning';
+ } else {
+ # Then it must be protected based on static groups (regular)
+ $noticeMsg = 'protectedpagewarning';
+ }
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
+ [ 'lim' => 1, 'msgKey' => [ $noticeMsg ] ] );
+ }
+ if ( $this->mTitle->isCascadeProtected() ) {
+ # Is this page under cascading protection from some source pages?
+ /** @var Title[] $cascadeSources */
+ list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
+ $notice = "<div class='mw-cascadeprotectedwarning'>\n$1\n";
+ $cascadeSourcesCount = count( $cascadeSources );
+ if ( $cascadeSourcesCount > 0 ) {
+ # Explain, and list the titles responsible
+ foreach ( $cascadeSources as $page ) {
+ $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
+ }
+ }
+ $notice .= '</div>';
+ $wgOut->wrapWikiMsg( $notice, [ 'cascadeprotectedwarning', $cascadeSourcesCount ] );
+ }
+ if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
+ [ 'lim' => 1,
+ 'showIfEmpty' => false,
+ 'msgKey' => [ 'titleprotectedwarning' ],
+ 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ] );
+ }
+ }
+
+ /**
+ * @param OutputPage $out
+ * @since 1.29
+ */
+ protected function addExplainConflictHeader( OutputPage $out ) {
+ $out->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1\n</div>", 'explainconflict' );
+ }
+
+ /**
+ * @param string $name
+ * @param mixed[] $customAttribs
+ * @param User $user
+ * @return mixed[]
+ * @since 1.29
+ */
+ protected function buildTextboxAttribs( $name, array $customAttribs, User $user ) {
+ $attribs = $customAttribs + [
+ 'accesskey' => ',',
+ 'id' => $name,
+ 'cols' => $user->getIntOption( 'cols' ),
+ 'rows' => $user->getIntOption( 'rows' ),
+ // Avoid PHP notices when appending preferences
+ // (appending allows customAttribs['style'] to still work).
+ 'style' => ''
+ ];
+
+ // The following classes can be used here:
+ // * mw-editfont-default
+ // * mw-editfont-monospace
+ // * mw-editfont-sans-serif
+ // * mw-editfont-serif
+ $class = 'mw-editfont-' . $user->getOption( 'editfont' );
+
+ if ( isset( $attribs['class'] ) ) {
+ if ( is_string( $attribs['class'] ) ) {
+ $attribs['class'] .= ' ' . $class;
+ } elseif ( is_array( $attribs['class'] ) ) {
+ $attribs['class'][] = $class;
+ }
+ } else {
+ $attribs['class'] = $class;
+ }
+
+ $pageLang = $this->mTitle->getPageLanguage();
+ $attribs['lang'] = $pageLang->getHtmlCode();
+ $attribs['dir'] = $pageLang->getDir();
+
+ return $attribs;
+ }
+
+ /**
+ * @param string $wikitext
+ * @return string
+ * @since 1.29
+ */
+ protected function addNewLineAtEnd( $wikitext ) {
+ if ( strval( $wikitext ) !== '' ) {
+ // Ensure there's a newline at the end, otherwise adding lines
+ // is awkward.
+ // But don't add a newline if the text is empty, or Firefox in XHTML
+ // mode will show an extra newline. A bit annoying.
+ $wikitext .= "\n";
+ return $wikitext;
+ }
+ return $wikitext;
+ }