| @@ 4680-4694 (lines=15) @@ | ||
| 4677 | // Optional notice for the entire namespace |
|
| 4678 | $editnotice_ns = 'editnotice-' . $this->getNamespace(); |
|
| 4679 | $msg = wfMessage( $editnotice_ns ); |
|
| 4680 | if ( $msg->exists() ) { |
|
| 4681 | $html = $msg->parseAsBlock(); |
|
| 4682 | // Edit notices may have complex logic, but output nothing (T91715) |
|
| 4683 | if ( trim( $html ) !== '' ) { |
|
| 4684 | $notices[$editnotice_ns] = Html::rawElement( |
|
| 4685 | 'div', |
|
| 4686 | [ 'class' => [ |
|
| 4687 | 'mw-editnotice', |
|
| 4688 | 'mw-editnotice-namespace', |
|
| 4689 | Sanitizer::escapeClass( "mw-$editnotice_ns" ) |
|
| 4690 | ] ], |
|
| 4691 | $html |
|
| 4692 | ); |
|
| 4693 | } |
|
| 4694 | } |
|
| 4695 | ||
| 4696 | if ( MWNamespace::hasSubpages( $this->getNamespace() ) ) { |
|
| 4697 | // Optional notice for page itself and any parent page |
|
| @@ 4703-4716 (lines=14) @@ | ||
| 4700 | while ( count( $parts ) > 0 ) { |
|
| 4701 | $editnotice_base .= '-' . array_shift( $parts ); |
|
| 4702 | $msg = wfMessage( $editnotice_base ); |
|
| 4703 | if ( $msg->exists() ) { |
|
| 4704 | $html = $msg->parseAsBlock(); |
|
| 4705 | if ( trim( $html ) !== '' ) { |
|
| 4706 | $notices[$editnotice_base] = Html::rawElement( |
|
| 4707 | 'div', |
|
| 4708 | [ 'class' => [ |
|
| 4709 | 'mw-editnotice', |
|
| 4710 | 'mw-editnotice-base', |
|
| 4711 | Sanitizer::escapeClass( "mw-$editnotice_base" ) |
|
| 4712 | ] ], |
|
| 4713 | $html |
|
| 4714 | ); |
|
| 4715 | } |
|
| 4716 | } |
|
| 4717 | } |
|
| 4718 | } else { |
|
| 4719 | // Even if there are no subpages in namespace, we still don't want "/" in MediaWiki message keys |
|
| @@ 4722-4735 (lines=14) @@ | ||
| 4719 | // Even if there are no subpages in namespace, we still don't want "/" in MediaWiki message keys |
|
| 4720 | $editnoticeText = $editnotice_ns . '-' . strtr( $this->getDBkey(), '/', '-' ); |
|
| 4721 | $msg = wfMessage( $editnoticeText ); |
|
| 4722 | if ( $msg->exists() ) { |
|
| 4723 | $html = $msg->parseAsBlock(); |
|
| 4724 | if ( trim( $html ) !== '' ) { |
|
| 4725 | $notices[$editnoticeText] = Html::rawElement( |
|
| 4726 | 'div', |
|
| 4727 | [ 'class' => [ |
|
| 4728 | 'mw-editnotice', |
|
| 4729 | 'mw-editnotice-page', |
|
| 4730 | Sanitizer::escapeClass( "mw-$editnoticeText" ) |
|
| 4731 | ] ], |
|
| 4732 | $html |
|
| 4733 | ); |
|
| 4734 | } |
|
| 4735 | } |
|
| 4736 | } |
|
| 4737 | ||
| 4738 | Hooks::run( 'TitleGetEditNotices', [ $this, $oldid, &$notices ] ); |
|