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,16 +81,60 @@ class FDroid
|
||||||
$page=1;
|
$page=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter=null;
|
$filter=$wp_query->query_vars['fdfilter'];
|
||||||
if(isset($wp_query->query_vars['fdfilter']))
|
$fdid=$wp_query->query_vars['fdid'];
|
||||||
$filter=$wp_query->query_vars['fdfilter'];
|
|
||||||
|
|
||||||
$out=$this->get_apps($page,$filter);
|
if($fdid!==null)
|
||||||
|
$out=$this->get_app($fdid);
|
||||||
|
else
|
||||||
|
$out=$this->get_apps($page,$filter);
|
||||||
return $out;
|
return $out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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":
|
||||||
|
$name=$el;
|
||||||
|
break;
|
||||||
|
case "icon":
|
||||||
|
$icon=$el;
|
||||||
|
break;
|
||||||
|
case "summary":
|
||||||
|
$summary=$el;
|
||||||
|
break;
|
||||||
|
case "license":
|
||||||
|
$license=$el;
|
||||||
|
break;
|
||||||
|
case "source":
|
||||||
|
$source=$el;
|
||||||
|
break;
|
||||||
|
case "issues":
|
||||||
|
$issues=$el;
|
||||||
|
break;
|
||||||
|
case "web":
|
||||||
|
$web=$el;
|
||||||
|
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) {
|
function get_apps($page,$filter=null) {
|
||||||
|
|
||||||
|
|
@ -108,6 +152,8 @@ class FDroid
|
||||||
$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();
|
||||||
|
$id=$attrs['id'];
|
||||||
foreach($app->children() as $el) {
|
foreach($app->children() as $el) {
|
||||||
switch($el->getName()) {
|
switch($el->getName()) {
|
||||||
case "name":
|
case "name":
|
||||||
|
|
@ -122,15 +168,6 @@ class FDroid
|
||||||
case "license":
|
case "license":
|
||||||
$license=$el;
|
$license=$el;
|
||||||
break;
|
break;
|
||||||
case "source":
|
|
||||||
$source=$el;
|
|
||||||
break;
|
|
||||||
case "issues":
|
|
||||||
$issues=$el;
|
|
||||||
break;
|
|
||||||
case "web":
|
|
||||||
$web=$el;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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