]> dev.renevier.net Git - syp.git/blobdiff - inc/i10n/updatelang.php
small code cleanup (indentation, missing copyrights, etc)
[syp.git] / inc / i10n / updatelang.php
index 04b12ec85359061de865d9f97b509f3686c41462..0d1498f73e1143c04d1f15823b217185c96bdcd5 100755 (executable)
@@ -1,13 +1,16 @@
 #!/usr/bin/php
 <?php
+/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
+   license. */
 
 // only execute from command line
 if (!(isset ($argc)) || !(isset ($argv))) {
     exit (0);
 }
 
-$ROOTDIR="../../";
-$SCRIPTS=array("admin", "index", "wizard"); // scripts in rootdir we need to link to
+$ROOTDIR = "../../";
+// scripts in rootdir we need to link to
+$SCRIPTS = array ("admin", "index", "wizard");
 
 function usage() {
     global $argv;
@@ -47,11 +50,11 @@ function main($argv, $argc, $rootdir, $scripts) {
 }
 
 function escape_newline ($str, $tab) {
-    return str_replace("\n", "\\n\" .\n$tab$tab\"", $str);
+    return str_replace ("\n", "\\n\" .\n$tab$tab\"", $str);
 }
 function escape_slash ($str) {
-    $res = str_replace("\\", "\\\\", $str);
-    $res = str_replace("\"", "\\\"", $res);
+    $res = str_replace ("\\", "\\\\", $str);
+    $res = str_replace ("\"", "\\\"", $res);
     return $res;
 }
 
@@ -61,7 +64,7 @@ function escape_all ($str, $tab) {
     return $str;
 }
 
-function updatelang($lang, $rootdir, $scripts) {
+function updatelang ($lang, $rootdir, $scripts) {
     if (!preg_match ('/^[a-zA-Z]{2,3}(-[a-zA-Z]{2,3})?$/', $lang)) {
         warn ("$lang is not a valid lang format.\n");
         return false;
@@ -70,7 +73,7 @@ function updatelang($lang, $rootdir, $scripts) {
         warn ("en is reference language. It must be managed manually.\n");
         return false;
     }
-    
+
     if (!is_dir ($lang)) {
         if (!mkdir ($lang)) {
             error ("could not create $lang directory.\n");
@@ -90,7 +93,7 @@ function updatelang($lang, $rootdir, $scripts) {
     $tab = str_repeat (" ", 4);
 
     $tmpname = tempnam ("", "");
-    $output = fopen($tmpname, "w");
+    $output = fopen ($tmpname, "w");
 
     fwrite ($output, "<?php\n");
 
@@ -139,7 +142,7 @@ function updatelang($lang, $rootdir, $scripts) {
         error ("could not set permissions to $lang/sys.php");
         return false;
     }
-    
+
     foreach ($scripts as $script) {
         $link = $rootdir . "/"  . $script . "." . $lang . ".php";
         $target = $script . ".php";