mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +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;
|
$page=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter=null;
|
|
||||||
if(isset($wp_query->query_vars['fdfilter']))
|
|
||||||
$filter=$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);
|
$out=$this->get_apps($page,$filter);
|
||||||
return $out;
|
return $out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_app($id) {
|
||||||
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");
|
$xml = simplexml_load_file("/home/fdroid/public_html/repo/index.xml");
|
||||||
foreach($xml->children() as $app) {
|
foreach($xml->children() as $app) {
|
||||||
|
|
||||||
|
$attrs=$app->attributes();
|
||||||
|
if($attrs['id']==$id) {
|
||||||
foreach($app->children() as $el) {
|
foreach($app->children() as $el) {
|
||||||
switch($el->getName()) {
|
switch($el->getName()) {
|
||||||
case "name":
|
case "name":
|
||||||
|
|
@ -133,6 +125,51 @@ class FDroid
|
||||||
break;
|
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($filter===null || stristr($name,$filter)) {
|
||||||
if($skipped<($page-1)*$perpage) {
|
if($skipped<($page-1)*$perpage) {
|
||||||
|
|
@ -141,6 +178,9 @@ class FDroid
|
||||||
$out.="<h2>".$name."</h2>";
|
$out.="<h2>".$name."</h2>";
|
||||||
$out.='<p><img src="http://f-droid.org/repo/icons/'.$icon.'" width=40>';
|
$out.='<p><img src="http://f-droid.org/repo/icons/'.$icon.'" width=40>';
|
||||||
$out.=$summary;
|
$out.=$summary;
|
||||||
|
$out.='<br><a href="';
|
||||||
|
$out.=$this->makelink("fdid=".$id);
|
||||||
|
$out.='">Details...</a>';
|
||||||
$out.="</p>";
|
$out.="</p>";
|
||||||
$got++;
|
$got++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue