diff --git a/wp-fdroid/wp-fdroid.php b/wp-fdroid/wp-fdroid.php
index 42d029f4..96d6827d 100644
--- a/wp-fdroid/wp-fdroid.php
+++ b/wp-fdroid/wp-fdroid.php
@@ -36,6 +36,7 @@ class FDroid
// Register additional query variables. (Handler for the 'query_vars' filter)
function queryvars($qvars) {
$qvars[]='fdfilter';
+ $qvars[]='fdcategory';
$qvars[]='fdid';
$qvars[]='fdpage';
$qvars[]='fdstyle';
@@ -89,11 +90,20 @@ class FDroid
$query_vars['fdfilter'] = '';
}
+ if($query_vars['fdcategory'] == 'All applications') {
+ unset($query_vars['fdcategory']);
+ }
+
if($query_vars['fdid']!==null) {
$out.=$this->get_app($query_vars);
} else {
- if($query_vars['fdfilter'] !== null)
- $out.=$this->show_search($query_vars);
+ if($query_vars['fdfilter'] !== null) {
+ $out.='
'."\n";
+ }
$out.=$this->get_apps($query_vars);
}
@@ -454,15 +464,31 @@ class FDroid
if(($query_vars['fdfilter']===null || $query_vars['fdfilter']!='') && $numpages>0)
{
$out.='';
- if($query_vars['fdfilter']===null)
- $out.="All applications";
- else
+ if($query_vars['fdfilter']===null) {
+ $categories = array('All applications','Games','Internet','Multimedia','Navigation','Office','System');
+
+ $out.=''."\n";
+ }
+ else {
$out.='Applications matching "'.$query_vars['fdfilter'].'"';
+ }
$out.="
";
$out.='';
- $out.='
List | ';
- $out.='
Grid';
+ $out.='
List | ';
+ $out.='
Grid';
$out.='
';
$out.='
';
@@ -508,12 +534,9 @@ class FDroid
}
- function show_search($query_vars) {
+ function makeformdata($query_vars) {
$out='';
- $out.=''."\n";
-
return $out;
}
@@ -565,10 +586,13 @@ class FDroid
case "license":
$appinfo['license']=$el;
break;
+ case "category":
+ $appinfo['category']=$el;
+ break;
}
}
- if($query_vars['fdfilter']===null || $query_vars['fdfilter']!='' && (stristr($appinfo['name'],$query_vars['fdfilter']) || stristr($appinfo['summary'],$query_vars['fdfilter']) || stristr($appinfo['description'],$query_vars['fdfilter']))) {
+ if(($query_vars['fdfilter']===null || $query_vars['fdfilter']!='' && (stristr($appinfo['name'],$query_vars['fdfilter']) || stristr($appinfo['summary'],$query_vars['fdfilter']) || stristr($appinfo['description'],$query_vars['fdfilter']))) && (!isset($query_vars['fdcategory']) || $query_vars['fdcategory'] && $query_vars['fdcategory']==$appinfo['category'])) {
if($skipped<($query_vars['fdpage']-1)*$outputter->perpage) {
$skipped++;
} else if($got<$outputter->perpage) {