jenkins-bot has submitted this change and it was merged.
Change subject: InlineDiffFormatter: Use writeOutput() when available
......................................................................
InlineDiffFormatter: Use writeOutput() when available
For compatibility with core change Idf2a6c59.
Change-Id: I81dd01cbb9ce11b87115fb1fed511027aee436a1
---
M includes/diff/InlineDiffFormatter.php
1 file changed, 23 insertions(+), 9 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
Objections:
Florianschmidtwelzow: There's a problem with this change, please improve
diff --git a/includes/diff/InlineDiffFormatter.php
b/includes/diff/InlineDiffFormatter.php
index 2b3c583..2ad9ccf 100644
--- a/includes/diff/InlineDiffFormatter.php
+++ b/includes/diff/InlineDiffFormatter.php
@@ -28,9 +28,9 @@
*/
function added( $lines ) {
foreach ( $lines as $line ) {
- echo '<div class="mw-diff-inline-added"><ins>'
+ $this->writeOutput( '<div
class="mw-diff-inline-added"><ins>'
. $this->lineOrNbsp( htmlspecialchars( $line ) )
- . "</ins></div>\n";
+ . "</ins></div>\n" );
}
}
@@ -41,9 +41,9 @@
*/
function deleted( $lines ) {
foreach ( $lines as $line ) {
- echo '<div class="mw-diff-inline-deleted"><del>'
+ $this->writeOutput( '<div
class="mw-diff-inline-deleted"><del>'
. $this->lineOrNbsp( htmlspecialchars( $line ) )
- . "</del></div>\n";
+ . "</del></div>\n" );
}
}
@@ -55,8 +55,8 @@
*/
function context( $lines ) {
foreach ( $lines as $line ) {
- echo "<div class=\"mw-diff-inline-context\">" .
- "{$this->contextLine( htmlspecialchars( $line )
)}</div>\n";
+ $this->writeOutput( "<div
class=\"mw-diff-inline-context\">" .
+ "{$this->contextLine( htmlspecialchars( $line )
)}</div>\n" );
}
}
@@ -95,14 +95,14 @@
* @param string[] $closing New content to compare with
*/
function changed( $orig, $closing ) {
- echo '<div class="mw-diff-inline-changed">';
+ $this->writeOutput( '<div class="mw-diff-inline-changed">' );
$diff = new WordLevelDiff( $orig, $closing );
$edits = $this->inlineWordDiff( $diff );
# WordLevelDiff returns already HTML-escaped output.
- echo implode( '', $edits );
+ $this->writeOutput( implode( '', $edits ) );
- echo "</div>\n";
+ $this->writeOutput( "</div>\n" );
}
/**
@@ -130,4 +130,18 @@
return $lines;
}
+
+ /**
+ * Writes a string to the output buffer.
+ *
+ * @param string $text
+ */
+ protected function writeOutput( $text ) {
+ if ( is_callable( 'parent::writeOutput' ) ) {
+ parent::writeOutput( $text );
+ } else {
+ // Pre-Idf2a6c59 version of MediaWiki
+ echo $text;
+ }
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/266956
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I81dd01cbb9ce11b87115fb1fed511027aee436a1
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits