From 4bd9991335495b7bc5d37a705e070d4df05cdbc3 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 16 Aug 2014 12:29:04 +0100 Subject: [PATCH] Surround edit notices with appropriate classes This commit adds a
around edit notices with relevant classes to aid in the creation of user scripts, following an earlier change (bug 30959) for edit intros. It adds an .mw-editnotice class to each edit notice, and because classes are fairly cheap, a second mirroring the edit notice's message key, and a third depending on the edit notice type: .mw-editnotice-namespace for a namespace-wide edit notice .mw-editnotice-base for a edit notice for the subpage's base page .mw-editnotice-page for an edit notice set explicitly for the page Classes are sanitized where required. Bug: 68749 Change-Id: Idf44f2a344d64893f799286914bda3f8d4aff6bf --- includes/Title.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index a1b2352f5e..b25676cb49 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -5007,7 +5007,9 @@ class Title { $editnotice_ns = 'editnotice-' . $this->getNamespace(); $editnotice_ns_message = wfMessage( $editnotice_ns ); if ( $editnotice_ns_message->exists() ) { - $notices[$editnotice_ns] = $editnotice_ns_message->parseAsBlock(); + $notices[$editnotice_ns] = '
' . + $editnotice_ns_message->parseAsBlock() . '
'; } if ( MWNamespace::hasSubpages( $this->getNamespace() ) ) { $parts = explode( '/', $this->getDBkey() ); @@ -5016,7 +5018,9 @@ class Title { $editnotice_base .= '-' . array_shift( $parts ); $editnotice_base_msg = wfMessage( $editnotice_base ); if ( $editnotice_base_msg->exists() ) { - $notices[$editnotice_base] = $editnotice_base_msg->parseAsBlock(); + $notices[$editnotice_base] = '
' . + $editnotice_base_msg->parseAsBlock() . '
'; } } } else { @@ -5024,7 +5028,9 @@ class Title { $editnoticeText = $editnotice_ns . '-' . str_replace( '/', '-', $this->getDBkey() ); $editnoticeMsg = wfMessage( $editnoticeText ); if ( $editnoticeMsg->exists() ) { - $notices[$editnoticeText] = $editnoticeMsg->parseAsBlock(); + $notices[$editnoticeText] = '
' . + $editnoticeMsg->parseAsBlock() . '
'; } } -- 2.20.1