home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / display_select_lang.lib.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  3.6 KB  |  124 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  * Code for displaying language selection
  5.  *
  6.  * @version $Id: display_select_lang.lib.php 11326 2008-06-17 21:32:48Z lem9 $
  7.  */
  8. if (! defined('PHPMYADMIN')) {
  9.     exit;
  10. }
  11.  
  12. /**
  13.  * Sorts available languages by their true english names
  14.  *
  15.  * @param   array   the array to be sorted
  16.  * @param   mixed   a required parameter
  17.  * @return  the sorted array
  18.  * @access  private
  19.  */
  20. function PMA_language_cmp(&$a, &$b) {
  21.     return (strcmp($a[1], $b[1]));
  22. } // end of the 'PMA_language_cmp()' function
  23.  
  24. /**
  25.  * Displays for for language selection
  26.  *
  27.  * @access  public
  28.  */
  29. function PMA_select_language($use_fieldset = FALSE) {
  30.     global $cfg, $lang;
  31.     ?>
  32.  
  33. <form method="post" action="index.php" target="_parent">
  34.     <?php
  35.     if (isset($GLOBALS['collation_connection'])) {
  36.         echo '            <input type="hidden" name="collation_connection" value="'
  37.             . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
  38.     }
  39.     if (isset($GLOBALS['convcharset'])) {
  40.         echo '            <input type="hidden" name="convcharset" value="'
  41.             . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
  42.     }
  43.     if (strlen($GLOBALS['db'])) {
  44.         echo '            <input type="hidden" name="db" value="'
  45.             . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
  46.     }
  47.     if (strlen($GLOBALS['table'])) {
  48.         echo '            <input type="hidden" name="table" value="'
  49.             . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
  50.     }
  51.     if (isset($GLOBALS['server'])) {
  52.         echo '            <input type="hidden" name="server" value="'
  53.             . ((int)$GLOBALS['server']) . '" />' . "\n";
  54.     }
  55.  
  56.     $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' .
  57.             ($cfg['ReplaceHelpImg'] ?
  58.                 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
  59.                 '(*)') . '</a>';
  60.     if ($use_fieldset) {
  61.         echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
  62.     } else {
  63.         echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
  64.     }
  65.     ?>
  66.  
  67.     <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
  68.     <?php
  69.  
  70.     uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
  71.     foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
  72.         $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
  73.  
  74.         // Include native name if non empty
  75.         if (!empty($tmplang[3])) {
  76.             $lang_name = $tmplang[3] . ' - '
  77.                 . $lang_name;
  78.         }
  79.  
  80.         // Include charset if it makes sense
  81.         if (!defined('PMA_REMOVED_NON_UTF_8')) {
  82.             $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
  83.         }
  84.  
  85.         //Is current one active?
  86.         if ($lang == $id) {
  87.             $selected = ' selected="selected"';
  88.         } else {
  89.             $selected = '';
  90.         }
  91.  
  92.         echo '        ';
  93.         echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
  94.             . '</option>' . "\n";
  95.     }
  96.     ?>
  97.  
  98.     </select>
  99.     <?php
  100.     if ($use_fieldset) {
  101.         echo '</fieldset>';
  102.     }
  103.     ?>
  104.  
  105.     <noscript>
  106.     <?php
  107.     if ($use_fieldset) {
  108.         echo '<fieldset class="tblFooters">';
  109.     }
  110.     ?>
  111.  
  112.         <input type="submit" value="Go" />
  113.     <?php
  114.     if ($use_fieldset) {
  115.         echo '</fieldset>';
  116.     }
  117.     ?>
  118.  
  119.     </noscript>
  120. </form>
  121.     <?php
  122. } // End of function PMA_select_language
  123. ?>
  124.