X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Flanguage%2FStatOutputs.php;h=f9390f6fdfd8bd5f18bec93dc54ea801486c79b6;hb=075b90235e86de663c000db2c90253509bb97375;hp=e9d8c86dd0c5c06cd67defea964ee97fe18fa38f;hpb=ace9be9562a8301c80ef2295601b606aee4e9ce1;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/language/StatOutputs.php b/maintenance/language/StatOutputs.php index e9d8c86dd0..f9390f6fdf 100644 --- a/maintenance/language/StatOutputs.php +++ b/maintenance/language/StatOutputs.php @@ -1,7 +1,4 @@ " . $version . "\n\n"; - echo "'''Note:''' These statistics can be generated by running php maintenance/language/transstat.php.\n\n"; - echo "For additional information on specific languages (the message names, the actual problems, etc.), run php maintenance/language/checkLanguage.php --lang=foo.\n\n"; + echo "'''Note:''' These statistics can be generated by running " . + "php maintenance/language/transstat.php.\n\n"; + echo "For additional information on specific languages (the message names, the actual " . + "problems, etc.), run php maintenance/language/checkLanguage.php --lang=foo.\n\n"; echo 'English (en) is excluded because it is the default localization'; if ( is_array( $wgDummyLanguageCodes ) ) { $dummyCodes = array(); foreach ( $wgDummyLanguageCodes as $dummyCode => $correctCode ) { $dummyCodes[] = Language::fetchLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; } - echo ', as well as the following languages that are not intended for system message translations, usually because they redirect to other language codes: ' . implode( ', ', $dummyCodes ); + echo ', as well as the following languages that are not intended for ' . + 'system message translations, usually because they redirect to other ' . + 'language codes: ' . implode( ', ', $dummyCodes ); } echo ".\n\n"; # dot to end sentence - echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n"; + echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; ' . + 'border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n"; } + function footer() { echo "|}\n"; } + function blockstart() { echo "|-\n"; } + function blockend() { echo ''; } + function element( $in, $heading = false ) { echo ( $heading ? '!' : '|' ) . "$in\n"; } + function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) { - $v = @round( 255 * $subset / $total ); + wfSuppressWarnings(); + $v = round( 255 * $subset / $total ); + wfRestoreWarnings(); + if ( $revert ) { # Weigh reverse with factor 20 so coloring takes effect more quickly as # this option is used solely for reporting 'bad' percentages. @@ -100,25 +117,28 @@ class wikiStatsOutput extends statsOutput { $color = $red . $green . $blue; $percent = parent::formatPercent( $subset, $total, $revert, $accuracy ); + return 'style="background-color:#' . $color . ';"|' . $percent; } } /** Output text. To be used on a terminal for example. */ -class textStatsOutput extends statsOutput { +class TextStatsOutput extends StatsOutput { function element( $in, $heading = false ) { echo $in . "\t"; } + function blockend() { echo "\n"; } } /** csv output. Some people love excel */ -class csvStatsOutput extends statsOutput { +class CsvStatsOutput extends StatsOutput { function element( $in, $heading = false ) { echo $in . ";"; } + function blockend() { echo "\n"; }