Changeset 9520 for trunk/admin


Ignore:
Timestamp:
Mar 4, 2011, 12:35:38 PM (14 years ago)
Author:
patdenice
Message:

feature:2210
Update language from piwigo.org extension repository

Location:
trunk/admin
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/languages.class.php

    r9518 r9520  
    3333  function languages($target_charset = null)
    3434  {
    35     $this->fs_languages = $this->get_fs_languages($target_charset);
     35    $this->get_fs_languages($target_charset);
    3636  }
    3737
     
    4848    $tabsheet = new tabsheet();
    4949    $tabsheet->add('languages_installed', l10n('Installed Languages'), $link.'languages_installed');
     50    $tabsheet->add('languages_update', l10n('Check for updates'), $link.'languages_update');
    5051    $tabsheet->add('languages_new', l10n('Add New Language'), $link.'languages_new');
    5152    $tabsheet->select($selected);
     
    171172        {
    172173          $language = array(
     174              'name'=>$file,
    173175              'code'=>$file,
    174176              'version'=>'0',
     
    212214    closedir($dir);
    213215    @uasort($this->fs_languages, 'name_compare');
    214 
    215     return $this->fs_languages;
    216216  }
    217217
     
    283283      'version' => implode(',', $versions_to_check),
    284284      'lang' => $user['language'],
     285      'get_nb_downloads' => 'true',
    285286      )
    286287    );
     
    308309        if (preg_match('/^.*? \[[A-Z]{2}\]$/', $language['extension_name']))
    309310        {
    310           $this->server_languages[$language['extension_name']] = $language;
    311         }
    312       }
    313       @ksort($this->server_languages);
     311          $this->server_languages[$language['extension_id']] = $language;
     312        }
     313      }
     314      @uasort($this->server_languages, array($this, 'extension_name_compare'));
    314315      return true;
    315316    }
     
    379380                if ($status == 'ok')
    380381                {
    381                   $this->fs_languages = $this->get_fs_languages();
    382                   $this->perform_action('activate', $dest);
     382                  $this->get_fs_languages();
     383                  if ($action == 'install')
     384                  {
     385                    $this->perform_action('activate', $dest);
     386                  }
    383387                }
    384388                if (file_exists($extract_path.'/obsolete.list')
     
    472476    }
    473477  }
     478
     479  /**
     480   * Sort functions
     481   */
     482  function language_version_compare($a, $b)
     483  {
     484    $pattern = array('/([a-z])/ei', '/\.+/', '/\.\Z|\A\./');
     485    $replacement = array( "'.'.intval('\\1', 36).'.'", '.', '');
     486
     487    $array = preg_replace($pattern, $replacement, array($a, $b));
     488
     489    return version_compare($array[0], $array[1], '>=');
     490  }
     491
     492  function extension_name_compare($a, $b)
     493  {
     494    return strcmp(strtolower($a['extension_name']), strtolower($b['extension_name']));
     495  }
    474496}
    475497?>
Note: See TracChangeset for help on using the changeset viewer.