| @@ 4749-4763 (lines=15) @@ | ||
| 4746 | // Optional notice for the entire namespace |
|
| 4747 | $editnotice_ns = 'editnotice-' . $this->getNamespace(); |
|
| 4748 | $msg = wfMessage( $editnotice_ns ); |
|
| 4749 | if ( $msg->exists() ) { |
|
| 4750 | $html = $msg->parseAsBlock(); |
|
| 4751 | // Edit notices may have complex logic, but output nothing (T91715) |
|
| 4752 | if ( trim( $html ) !== '' ) { |
|
| 4753 | $notices[$editnotice_ns] = Html::rawElement( |
|
| 4754 | 'div', |
|
| 4755 | [ 'class' => [ |
|
| 4756 | 'mw-editnotice', |
|
| 4757 | 'mw-editnotice-namespace', |
|
| 4758 | Sanitizer::escapeClass( "mw-$editnotice_ns" ) |
|
| 4759 | ] ], |
|
| 4760 | $html |
|
| 4761 | ); |
|
| 4762 | } |
|
| 4763 | } |
|
| 4764 | ||
| 4765 | if ( MWNamespace::hasSubpages( $this->getNamespace() ) ) { |
|
| 4766 | // Optional notice for page itself and any parent page |
|
| @@ 4772-4785 (lines=14) @@ | ||
| 4769 | while ( count( $parts ) > 0 ) { |
|
| 4770 | $editnotice_base .= '-' . array_shift( $parts ); |
|
| 4771 | $msg = wfMessage( $editnotice_base ); |
|
| 4772 | if ( $msg->exists() ) { |
|
| 4773 | $html = $msg->parseAsBlock(); |
|
| 4774 | if ( trim( $html ) !== '' ) { |
|
| 4775 | $notices[$editnotice_base] = Html::rawElement( |
|
| 4776 | 'div', |
|
| 4777 | [ 'class' => [ |
|
| 4778 | 'mw-editnotice', |
|
| 4779 | 'mw-editnotice-base', |
|
| 4780 | Sanitizer::escapeClass( "mw-$editnotice_base" ) |
|
| 4781 | ] ], |
|
| 4782 | $html |
|
| 4783 | ); |
|
| 4784 | } |
|
| 4785 | } |
|
| 4786 | } |
|
| 4787 | } else { |
|
| 4788 | // Even if there are no subpages in namespace, we still don't want "/" in MediaWiki message keys |
|
| @@ 4791-4804 (lines=14) @@ | ||
| 4788 | // Even if there are no subpages in namespace, we still don't want "/" in MediaWiki message keys |
|
| 4789 | $editnoticeText = $editnotice_ns . '-' . strtr( $this->getDBkey(), '/', '-' ); |
|
| 4790 | $msg = wfMessage( $editnoticeText ); |
|
| 4791 | if ( $msg->exists() ) { |
|
| 4792 | $html = $msg->parseAsBlock(); |
|
| 4793 | if ( trim( $html ) !== '' ) { |
|
| 4794 | $notices[$editnoticeText] = Html::rawElement( |
|
| 4795 | 'div', |
|
| 4796 | [ 'class' => [ |
|
| 4797 | 'mw-editnotice', |
|
| 4798 | 'mw-editnotice-page', |
|
| 4799 | Sanitizer::escapeClass( "mw-$editnoticeText" ) |
|
| 4800 | ] ], |
|
| 4801 | $html |
|
| 4802 | ); |
|
| 4803 | } |
|
| 4804 | } |
|
| 4805 | } |
|
| 4806 | ||
| 4807 | Hooks::run( 'TitleGetEditNotices', [ $this, $oldid, &$notices ] ); |
|