Commit 34f4fc03 authored by Konstantin Pavlov's avatar Konstantin Pavlov

i18n: whitespace and readability fixes in php code

parent 320086ae
......@@ -47,15 +47,15 @@ should contact him to coordinate help.</p>
<?php
$lgfile="languages";
$file_id=fopen($lgfile,"r");
$contents = fread ($file_id, filesize($lgfile) );
fclose ($file_id );
$file_id = fopen( $lgfile,"r" );
$contents = fread( $file_id, filesize($lgfile) );
fclose( $file_id );
$langs = explode( "\n", $contents );
for($i=0; $i < count($langs)-1; $i++ )
for( $i = 0; $i < count($langs) - 1; $i++ )
{
list($lang,$po,$maint,$mail) = explode('|', $langs[$i]);
list( $lang, $po, $maint, $mail) = explode( '|', $langs[$i] );
echo "<tr><td class=\"category\">$lang</td>
<td><a href=\"mailto:$mail\">$maint</a></td></tr>\n";
......
......@@ -27,63 +27,60 @@
$reffile = "./vlc-stats.ref";
$lgfile = "./languages";
$file_id= fopen($reffile,"r");
$contents = fread ($file_id, filesize($reffile) );
fclose ($file_id );
$file_id = fopen( $reffile,"r" );
$contents = fread( $file_id, filesize($reffile) );
fclose( $file_id );
$langs = explode( "\n", $contents );
$file_id=fopen($lgfile,"r");
$contents = fread ($file_id, filesize($lgfile) );
fclose ($file_id );
$file_id = fopen( $lgfile, "r" );
$contents = fread( $file_id, filesize($lgfile) );
fclose( $file_id );
$languages = explode( "\n", $contents );
for($i=0;$i< count($languages) -1;$i++)
for( $i = 0; $i < count($languages) - 1; $i++ )
{
list($lg,$po,$a,$b) = explode('|',$languages[$i] );
$names[$po]=$lg;
list( $lg, $po, $a, $b ) = explode( '|', $languages[$i] );
$names[$po] = $lg;
}
for($i = 0 ; $i < count($langs) - 1;$i++ )
{
list($pofile,$tr,$fu,$ut) = explode(' ',$langs[$i] );
for( $i = 0; $i < count($langs) - 1; $i++ )
{
list( $pofile, $tr, $fu, $ut) = explode( ' ', $langs[$i] );
/* Calculate percentages */
$total = $tr+$fu+$ut;
$pc_tr = $tr*100/$total;
$pc_fu = $fu*100/$total;
$pc_ut = $ut*100/$total;
$total = $tr + $fu + $ut;
$pc_tr = $tr * 100 / $total;
$pc_fu = $fu * 100 / $total;
$pc_ut = $ut * 100 / $total;
/* Create image and colors */
$image = @imagecreatetruecolor(150,18);
$red = imagecolorallocate($image, 230, 50,50 );
$orange = imagecolorallocate($image, 200, 170 ,50 );
$green = imagecolorallocate($image, 110, 210 ,100 );
$black = imagecolorallocate($image, 0,0,0 );
/* Fill the image */
imagefilledrectangle ( $image,0,0,ceil(1.5*$pc_tr),17,$green );
imagefilledrectangle ( $image,ceil(1.5*$pc_tr),0,ceil(1.5*($pc_fu+$pc_tr)),17,$orange );
imagefilledrectangle ( $image,ceil(1.5*($pc_fu+$pc_tr)),0,150,17,$red );
imagestring( $image, 5, 65, 2 , floor($pc_tr)."%" , $black);
$image = @imagecreatetruecolor( 150, 18 );
$red = imagecolorallocate( $image, 230, 50, 50 );
$orange = imagecolorallocate( $image, 200, 170, 50 );
$green = imagecolorallocate( $image, 110, 210, 100 );
$black = imagecolorallocate( $image, 0, 0, 0 );
/* Fill the image */
imagefilledrectangle( $image, 0, 0, ceil( 1.5 * $pc_tr ), 17, $green );
imagefilledrectangle( $image, ceil( 1.5 * $pc_tr), 0 ,ceil( 1.5 * ($pc_fu + $pc_tr)), 17, $orange );
imagefilledrectangle( $image, ceil( 1.5 * ( $pc_fu + $pc_tr )), 0, 150, 17, $red );
imagestring( $image, 5, 65, 2 , floor($pc_tr)."%" , $black );
/* Save and destroy the image */
imagepng($image,"./images/image_$pofile.png");
imagedestroy($image);
imagepng( $image, "./images/image_$pofile.png" );
imagedestroy( $image );
/* Display results */
printf( "<tr class=\"i18n_stats\"><td class=\"i18n_stats\">%s</td>
<td class=\"i18n_stats\">%d</td><td class=\"i18n_stats2\">%.2f</td>
<td class=\"i18n_stats\">%d</td><td class=\"i18n_stats2\">%.2f</td>
<td class=\"i18n_stats\">%d</td><td class=\"i18n_stats2\">%.2f</td>
<td class=\"i18n_graph\"><img src=\"images/image_$pofile.png\" alt=\"$pofile\"/></td></tr>",$names[$pofile],$tr,$pc_tr,$fu,$pc_fu,$ut,$pc_ut);
<td class=\"i18n_graph\"><img src=\"images/image_$pofile.png\" alt=\"$pofile\"/></td></tr>", $names[$pofile], $tr, $pc_tr, $fu, $pc_fu, $ut, $pc_ut);
}
?>
</table>
<?php footer('$Id$'); ?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment