r95338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95337‎ | r95338 | r95339 >
Date:21:39, 23 August 2011
Author:johnduhart
Status:ok
Tags:
Comment:
(bug 23049) Fix cross-page transclusions. Patch by Beau
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -702,6 +702,8 @@
703703 $from = array_key_exists( 'from', $args ) ? $args['from'] : null;
704704 $to = array_key_exists( 'to', $args ) ? $args['to'] : null;
705705 $header = array_key_exists( 'header', $args ) ? $args['header'] : null;
 706+ $tosection = array_key_exists( 'tosection', $args ) ? $args['tosection'] : null;
 707+ $fromsection = array_key_exists( 'fromsection', $args ) ? $args['fromsection'] : null;
706708
707709 // abort if the tag is on an index page
708710 if ( preg_match( "/^$index_namespace:(.*?)(\/([0-9]*)|)$/", $parser->Title()->getPrefixedText() ) ) {
@@ -839,10 +841,15 @@
840842 if( !$is_q0 ) {
841843 $out .= '<span>{{:MediaWiki:Proofreadpage_pagenum_template|page=' . $text . "|num=$pagenum}}</span>";
842844 }
843 - if( $page == $from_page && $args['fromsection'] ) {
844 - $out .= '{{#lst:' . $text . '|' . $args['fromsection'] . '}}';
845 - } elseif( $page == $to_page && $args['tosection'] ) {
846 - $out .= '{{#lst:' . $text . '|' . $args['tosection'] . '}}';
 845+ if( $page == $from_page && $fromsection !== null ) {
 846+ $ts = '';
 847+ // Check if it is single page transclusion
 848+ if ( $page == $to_page && $tosection !== null ) {
 849+ $ts = $tosection;
 850+ }
 851+ $out .= '{{#lst:' . $text . '|' . $fromsection . '|' . $ts .'}}';
 852+ } elseif( $page == $to_page && $tosection != null ) {
 853+ $out .= '{{#lst:' . $text . '||' . $tosection . '}}';
847854 } else {
848855 $out .= '{{:' . $text . '}}';
849856 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r107785Fixed weak comparison with null from r95338.tstarling22:50, 1 January 2012

Status & tagging log