r54730 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54729‎ | r54730 | r54731 >
Date:17:36, 10 August 2009
Author:werdna
Status:ok
Tags:
Comment:
Rewrite some spaghetti code in Special:Log to fix invalid HTML, now uses proper Xml:: methods
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -77,27 +77,52 @@
7878 $month = '', $filter = null, $tagFilter='' )
7979 {
8080 global $wgScript, $wgMiserMode;
81 - $action = htmlspecialchars( $wgScript );
 81+
 82+ $action = $wgScript;
8283 $title = SpecialPage::getTitleFor( 'Log' );
83 - $special = htmlspecialchars( $title->getPrefixedDBkey() );
 84+ $special = $title->getPrefixedDBkey();
 85+
8486 // For B/C, we take strings, but make sure they are converted...
8587 $types = ($types === '') ? array() : (array)$types;
8688
8789 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
 90+
 91+ $html = '';
 92+ $html .= Xml::hidden( 'title', $special );
 93+
 94+ // Basic selectors
 95+ $html .= $this->getTypeMenu( $types ) . "\n";
 96+ $html .= $this->getUserInput( $user ) . "\n";
 97+ $html .= $this->getTitleInput( $page ) . "\n";
8898
89 - $this->out->addHTML( "<form action=\"$action\" method=\"get\"><fieldset>" .
90 - Xml::element( 'legend', array(), wfMsg( 'log' ) ) .
91 - Xml::hidden( 'title', $special ) . "\n" .
92 - $this->getTypeMenu( $types ) . "\n" .
93 - $this->getUserInput( $user ) . "\n" .
94 - $this->getTitleInput( $page ) . "\n" .
95 - ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) .
96 - "<p>" . Xml::dateMenu( $year, $month ) . "\n" .
97 - ( $tagSelector ? Xml::tags( 'p', null, implode( '&nbsp;', $tagSelector ) ) :'' ). "\n" .
98 - ( $filter ? "</p><p>".$this->getFilterLinks( $filter )."\n" : "" ) . "\n" .
99 - Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
100 - "</fieldset></form>"
101 - );
 99+ // Title pattern, if allowed
 100+ if (!$wgMiserMode) {
 101+ $html .= $this->getTitlePattern( $pattern ) . "\n";
 102+ }
 103+
 104+ // date menu
 105+ $html .= Xml::tags( 'p', null, Xml::dateMenu( $year, $month ) );
 106+
 107+ // Tag filter
 108+ if ($tagSelector) {
 109+ $html .= Xml::tags( 'p', null, implode( '&nbsp;', $tagSelector ) );
 110+ }
 111+
 112+ // Filter links
 113+ if ($filter) {
 114+ $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
 115+ }
 116+
 117+ // Submit button
 118+ $html .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
 119+
 120+ // Fieldset
 121+ $html = Xml::fieldset( wfMsg( 'log' ), $html );
 122+
 123+ // Form wrapping
 124+ $html = Xml::tags( 'form', array( 'action' => $action, 'method' => 'get' ), $html );
 125+
 126+ $this->out->addHTML( $html );
102127 }
103128
104129 /**

Status & tagging log