merge r3143 from trunk to branch 2.0

- Show number of downloads in plugins list.
- Allow to sort plugins by number of downloads.
- Fix plugin revision URL (no more revision_view in PEM).

git-svn-id: http://piwigo.org/svn/branches/2.0@3144 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice
2009-02-13 21:03:02 +00:00
parent 164fd3a280
commit 35e9af66be
15 changed files with 72 additions and 33 deletions

View File

@@ -304,6 +304,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"';
$url = PEM_URL . '/api/get_revision_list.php?category_id=12&format=php&last_revision_only=true';
$url .= '&version=' . implode(',', $versions_to_check);
$url .= '&lang=' . substr($user['language'], 0, 2);
$url .= '&get_nb_downloads=true';
if (!empty($plugins_to_check))
{
@@ -345,6 +346,9 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"';
case 'author':
uasort($this->server_plugins, array($this, 'extension_author_compare'));
break;
case 'downloads':
usort($this->server_plugins, array($this, 'extension_downloads_compare'));
break;
}
}
@@ -508,6 +512,12 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"';
else return $r;
}
function extension_downloads_compare($a, $b)
{
if ($a['extension_nb_downloads'] < $b['extension_nb_downloads']) return 1;
else return -1;
}
function sort_plugins_by_state()
{
uasort($this->fs_plugins, 'name_compare');