[geeklog-cvs] Geeklog-1.x/public_html/admin/install index.php, 1.40, 1.41

Dirk Haun dhaun at qs1489.pair.com
Sat May 24 15:12:04 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install
In directory qs1489.pair.com:/tmp/cvs-serv9243

Modified Files:
	index.php 
Log Message:
Need to pretty up the displayed language file name, now that we're getting more language files for the install script.


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install/index.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** index.php	11 May 2008 07:25:08 -0000	1.40
--- index.php	24 May 2008 19:12:02 -0000	1.41
***************
*** 954,957 ****
--- 954,992 ----
  
  /**
+  * Make a nice display name from the language filename
+  *
+  * @param    string  $file   filename without the extension
+  * @return   string          language name to display to the user
+  * @note     This code is a straight copy from MBYTE_languageList()
+  *
+  */
+ function INST_prettifyLanguageName($filename)
+ {
+     $langfile = str_replace ('_utf-8', '', $filename);
+     $uscore = strpos ($langfile, '_');
+     if ($uscore === false) {
+         $lngname = ucfirst ($langfile);
+     } else {
+         $lngname = ucfirst (substr ($langfile, 0, $uscore));
+         $lngadd = substr ($langfile, $uscore + 1);
+         $lngadd = str_replace ('utf-8', '', $lngadd);
+         $lngadd = str_replace ('_', ', ', $lngadd);
+         $word = explode (' ', $lngadd);
+         $lngadd = '';
+         foreach ($word as $w) {
+             if (preg_match ('/[0-9]+/', $w)) {
+                 $lngadd .= strtoupper ($w) . ' ';
+             } else {
+                 $lngadd .= ucfirst ($w) . ' ';
+             }
+         }
+         $lngname .= ' (' . trim ($lngadd) . ')';
+     }
+ 
+     return $lngname;
+ }
+ 
+ 
+ /**
   * Check if a table exists
   *
***************
*** 1630,1634 ****
      foreach (glob('language/*.php') as $filename) {
          $filename = preg_replace('/.php/', '', preg_replace('/language\//', '', $filename));
!         $display .= '<option value="' . $filename . '"' . (($filename == $language) ? ' selected="selected"' : '') . '>' . ucfirst($filename) . '</option>' . LB;
      }
  
--- 1665,1669 ----
      foreach (glob('language/*.php') as $filename) {
          $filename = preg_replace('/.php/', '', preg_replace('/language\//', '', $filename));
!         $display .= '<option value="' . $filename . '"' . (($filename == $language) ? ' selected="selected"' : '') . '>' . INST_prettifyLanguageName($filename) . '</option>' . LB;
      }
  




More information about the geeklog-cvs mailing list