[www-doc] [Git][VideoLAN.org/websites][master] i18n: whitespace and readability fixes in php code

Konstantin Pavlov gitlab at videolan.org
Wed Apr 15 00:06:37 CEST 2020



Konstantin Pavlov pushed to branch master at VideoLAN organization / websites


Commits:
34f4fc03 by Konstantin Pavlov at 2020-04-15T01:06:16+03:00
i18n: whitespace and readability fixes in php code

- - - - -


2 changed files:

- www.videolan.org/developers/i18n/index.php
- www.videolan.org/developers/i18n/vlcstat.php


Changes:

=====================================
www.videolan.org/developers/i18n/index.php
=====================================
@@ -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";


=====================================
www.videolan.org/developers/i18n/vlcstat.php
=====================================
@@ -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$'); ?>



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/34f4fc0352e5f8e58c60e7fc9d41ee7f36b6db57

-- 
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/34f4fc0352e5f8e58c60e7fc9d41ee7f36b6db57
You're receiving this email because of your account on code.videolan.org.




More information about the www-doc mailing list