mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 14:30:30 +03:00
WordPress plugin: now with app detail pages
This commit is contained in:
parent
f08f9c1b88
commit
53d3e0148d
2 changed files with 54 additions and 13 deletions
1
updateplugin.sh
Executable file
1
updateplugin.sh
Executable file
|
|
@ -0,0 +1 @@
|
|||
scp -r wp-fdroid/ fdroid@f-droid.org:/home/fdroid/public_html/wp-content/plugins
|
||||
|
|
@ -81,33 +81,25 @@ class FDroid
|
|||
$page=1;
|
||||
}
|
||||
|
||||
$filter=null;
|
||||
if(isset($wp_query->query_vars['fdfilter']))
|
||||
$filter=$wp_query->query_vars['fdfilter'];
|
||||
$fdid=$wp_query->query_vars['fdid'];
|
||||
|
||||
if($fdid!==null)
|
||||
$out=$this->get_app($fdid);
|
||||
else
|
||||
$out=$this->get_apps($page,$filter);
|
||||
return $out;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_apps($page,$filter=null) {
|
||||
|
||||
if($filter===null)
|
||||
$out="<p>All applications";
|
||||
else
|
||||
$out="<p>Applications matching ".$filter;
|
||||
$out.="</p>";
|
||||
|
||||
$perpage=10;
|
||||
$skipped=0;
|
||||
$got=0;
|
||||
$total=0;
|
||||
function get_app($id) {
|
||||
|
||||
$xml = simplexml_load_file("/home/fdroid/public_html/repo/index.xml");
|
||||
foreach($xml->children() as $app) {
|
||||
|
||||
$attrs=$app->attributes();
|
||||
if($attrs['id']==$id) {
|
||||
foreach($app->children() as $el) {
|
||||
switch($el->getName()) {
|
||||
case "name":
|
||||
|
|
@ -133,6 +125,51 @@ class FDroid
|
|||
break;
|
||||
}
|
||||
}
|
||||
$out="<h2>".$name."</h2>";
|
||||
$out.='<p><img src="http://f-droid.org/repo/icons/'.$icon.'" width=40>';
|
||||
$out.=$summary;
|
||||
$out.="</p>";
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
return "<p>Application not found</p>";
|
||||
}
|
||||
|
||||
|
||||
function get_apps($page,$filter=null) {
|
||||
|
||||
if($filter===null)
|
||||
$out="<p>All applications";
|
||||
else
|
||||
$out="<p>Applications matching ".$filter;
|
||||
$out.="</p>";
|
||||
|
||||
$perpage=10;
|
||||
$skipped=0;
|
||||
$got=0;
|
||||
$total=0;
|
||||
|
||||
$xml = simplexml_load_file("/home/fdroid/public_html/repo/index.xml");
|
||||
foreach($xml->children() as $app) {
|
||||
|
||||
$attrs=$app->attributes();
|
||||
$id=$attrs['id'];
|
||||
foreach($app->children() as $el) {
|
||||
switch($el->getName()) {
|
||||
case "name":
|
||||
$name=$el;
|
||||
break;
|
||||
case "icon":
|
||||
$icon=$el;
|
||||
break;
|
||||
case "summary":
|
||||
$summary=$el;
|
||||
break;
|
||||
case "license":
|
||||
$license=$el;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($filter===null || stristr($name,$filter)) {
|
||||
if($skipped<($page-1)*$perpage) {
|
||||
|
|
@ -141,6 +178,9 @@ class FDroid
|
|||
$out.="<h2>".$name."</h2>";
|
||||
$out.='<p><img src="http://f-droid.org/repo/icons/'.$icon.'" width=40>';
|
||||
$out.=$summary;
|
||||
$out.='<br><a href="';
|
||||
$out.=$this->makelink("fdid=".$id);
|
||||
$out.='">Details...</a>';
|
||||
$out.="</p>";
|
||||
$got++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue