r43011 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43010‎ | r43011 | r43012 >
Date:18:36, 1 November 2008
Author:brion
Status:old
Tags:
Comment:
format yen without decimal point -- you can't break yen into smaller pieces :)
Modified paths:
  • /trunk/extensions/ContributionReporting/ContributionHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php
@@ -48,10 +48,7 @@
4949 $name .= '<br />' . htmlspecialchars($row['note']);
5050 }
5151
52 - $amount = htmlspecialchars($row['original_currency'] . ' ' . $row['original_amount']);
53 - if (!$row['original_currency'] || !$row['original_amount']) {
54 - $amount = 'USD ' . htmlspecialchars($row['converted_amount']);
55 - }
 52+ $amount = $this->formatAmount( $row );
5653
5754 $class = '';
5855 if ($alt) {
@@ -73,4 +70,22 @@
7471 $wgOut->addHTML( $output );
7572 $wgOut->addWikiText('{{Template:Donate-footer/' . $language . '}}');
7673 }
 74+
 75+ function formatAmount( $row ) {
 76+ if( $row['original_currency'] ) {
 77+ $currency = $row['original_currency'];
 78+ $amount = $row['original_amount'];
 79+ } else {
 80+ $currency = 'USD';
 81+ $amount = $row['converted_amount'];
 82+ }
 83+
 84+ if( $currency == 'JPY' ) {
 85+ // No decimals for yen
 86+ $amount = intval( $amount );
 87+ }
 88+
 89+ return htmlspecialchars( "$currency $amount" );
 90+ }
 91+
7792 }

Status & tagging log