r106622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106621‎ | r106622 | r106623 >
Date:01:40, 19 December 2011
Author:yaron
Status:ok
Tags:
Comment:
Changed SFUtils::linkText() to generate wiki-text instead of HTML, and replaced the wfMsg() calls that used it with wfMsgExt() (fix for bug 33237)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_Templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -67,7 +67,7 @@
6868 if ( !is_null( $super_page ) && $super_page !== '' ) {
6969 $page_name = "$super_page/$page_name";
7070 }
71 -
 71+
7272 if ( $page_name !== '' ) {
7373 // Append the namespace prefix to the page name,
7474 // if this namespace was not already entered.
@@ -89,7 +89,7 @@
9090 }
9191
9292 if ( ( !$form_title || !$form_title->exists() ) && ( $form_name !== '' ) ) {
93 - $text = Xml::element( 'p', null, wfMsg( 'sf_formstart_badform', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 93+ $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
9494 } else {
9595 if ( $form_name === '' ) {
9696 $description = htmlspecialchars( wfMsg( 'sf_formstart_noform_docu', $form_name ) );
@@ -97,7 +97,7 @@
9898 else {
9999 $description = htmlspecialchars( wfMsg( 'sf_formstart_docu', $form_name ) );
100100 }
101 -
 101+
102102 $text = <<<END
103103 <form action="" method="post">
104104 <p>$description</p>
Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -148,7 +148,7 @@
149149 . "</div>\n";
150150
151151 } else {
152 - $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formstart_badform', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 152+ $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
153153 }
154154 } elseif ( $target_name === '' && $page_name_formula === '' ) {
155155 $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) . "\n";
Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -42,7 +42,7 @@
4343 $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_runquery_badurl' ) ) . "\n";
4444 } else {
4545 $text = Xml::tags( 'p', array( 'class' => 'error' ),
46 - wfMsg( 'sf_formstart_badform', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 46+ wfMsgExt( 'sf_formstart_badform', 'parseinline', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
4747 }
4848 $wgOut->addHTML( $text );
4949 return;
Index: trunk/extensions/SemanticForms/specials/SF_Templates.php
@@ -116,7 +116,7 @@
117117 $category = $this->getCategoryDefinedByTemplate( $title );
118118 if ( $category !== '' ) {
119119 SFUtils::loadMessages();
120 - $text .= ' ' . wfMsg( 'sf_templates_definescat', SFUtils::linkText( NS_CATEGORY, $category ) );
 120+ $text .= ' ' . wfMsgExt( 'sf_templates_definescat', 'parseinline', SFUtils::linkText( NS_CATEGORY, $category ) );
121121 }
122122 return $text;
123123 }
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -199,7 +199,7 @@
200200 }
201201
202202 /**
203 - * Creates HTML linking to a wiki page
 203+ * Creates wiki-text for a link to a wiki page
204204 */
205205 public static function linkText( $namespace, $name, $text = null ) {
206206 $title = Title::makeTitleSafe( $namespace, $name );
@@ -207,10 +207,10 @@
208208 return $name; // TODO maybe report an error here?
209209 }
210210 if ( is_null( $text ) ) {
211 - $text = $title->getText();
 211+ return '[[:' . $title->getPrefixedText() . '|' . $name . ']]';
 212+ } else {
 213+ return '[[:' . $title->getPrefixedText() . '|' . $text . ']]';
212214 }
213 - $l = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
214 - return $l->makeLinkObj( $title, htmlspecialchars( $text ) );
215215 }
216216
217217 /**

Status & tagging log