r102967 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102966‎ | r102967 | r102968 >
Date:11:06, 14 November 2011
Author:gwicke
Status:reverted
Tags:
Comment:
Modified paths:
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite_body.php
@@ -706,7 +706,7 @@
707707 'cite_references_link_one',
708708 $this->referencesKey( $key ),
709709 $this->refKey( $key, $val['count'] ),
710 - $this->error( 'cite_error_references_no_text', $key )
 710+ $this->error( 'cite_error_references_no_text', $key, false )
711711 );
712712 }
713713
@@ -717,7 +717,7 @@
718718 # $this->refKey( $val['key'], $val['count'] ),
719719 $this->refKey( $val['key'] ),
720720
721 - ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key ) )
 721+ ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key, false ) )
722722 );
723723 // Standalone named reference, I want to format this like an
724724 // anonymous reference because displaying "1. 1.1 Ref text" is
@@ -729,7 +729,7 @@
730730 $this->referencesKey( $key . "-" . $val['key'] ),
731731 # $this->refKey( $key, $val['count'] ),
732732 $this->refKey( $key, $val['key'] . "-" . $val['count'] ),
733 - ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key ) )
 733+ ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key, false ) )
734734 );
735735 // Named references with >1 occurrences
736736 } else {
@@ -749,7 +749,7 @@
750750 return wfMsgForContentNoTrans( 'cite_references_link_many',
751751 $this->referencesKey( $key . "-" . $val['key'] ),
752752 $list,
753 - ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key ) )
 753+ ( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key, false ) )
754754 );
755755 }
756756 }
@@ -793,7 +793,7 @@
794794 return $this->mBacklinkLabels[$offset];
795795 } else {
796796 // Feed me!
797 - return $this->error( 'cite_error_references_no_backlink_label' );
 797+ return $this->error( 'cite_error_references_no_backlink_label', null, false );
798798 }
799799 }
800800
@@ -823,7 +823,7 @@
824824 return $this->mLinkLabels[$group][$offset - 1];
825825 } else {
826826 // Feed me!
827 - return $this->error( 'cite_error_no_link_label_group', array( $group, $message ) );
 827+ return $this->error( 'cite_error_no_link_label_group', array( $group, $message ), false );
828828 }
829829 }
830830
@@ -1065,11 +1065,14 @@
10661066 continue;
10671067 }
10681068 $text .= "\n<br />";
 1069+ # Use separate parser from MessageCache to avoid it missing
 1070+ # replaceLinkHolders() when run from ParserBeforeTidy.
10691071 if ( $group == CITE_DEFAULT_GROUP ) {
1070 - $text .= $this->error( 'cite_error_refs_without_references' );
 1072+ $msg = $this->error( 'cite_error_refs_without_references', null, false );
10711073 } else {
1072 - $text .= $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
 1074+ $msg = $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ), false );
10731075 }
 1076+ $text .= MessageCache::singleton()->parse( $msg, $parser->getTitle(), false )->getText();
10741077 }
10751078 return true;
10761079 }
@@ -1117,18 +1120,20 @@
11181121 *
11191122 * @param string $key Message name for the error
11201123 * @param string $param Parameter to pass to the message
1121 - * @return string XHTML ready for output
 1124+ * @param boolean $parse Whether to parse the message
 1125+ * @return string XHTML or wikitext ready for output
11221126 */
1123 - function error( $key, $param = null ) {
 1127+ function error( $key, $param = null, $parse = true ) {
11241128 # We rely on the fact that PHP is okay with passing unused argu-
11251129 # ments to functions. If $1 is not used in the message, wfMsg will
11261130 # just ignore the extra parameter.
1127 - return
1128 - $this->parse(
1129 - '<strong class="error">' .
1130 - wfMsgNoTrans( 'cite_error', wfMsgNoTrans( $key, $param ) ) .
1131 - '</strong>'
1132 - );
 1131+ $ret = '<strong class="error">' .
 1132+ wfMsgNoTrans( 'cite_error', wfMsgNoTrans( $key, $param ) ) .
 1133+ '</strong>';
 1134+ if ( $parse ) {
 1135+ $ret = $this->parse( $ret );
 1136+ }
 1137+ return $ret;
11331138 }
11341139
11351140 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r102969Back out accidentally-committed r102967.gwicke11:14, 14 November 2011
r102972(bug 17865) Fix double-parsed error messages in Cite. Modified patch by Brad ...catrope12:22, 14 November 2011

Status & tagging log