diff --git a/wp-fdroid/wp-fdroid.php b/wp-fdroid/wp-fdroid.php
index fe19edd8..ce5f9526 100644
--- a/wp-fdroid/wp-fdroid.php
+++ b/wp-fdroid/wp-fdroid.php
@@ -1,19 +1,76 @@
';
+ if(isset($app[2]) && trim($app[2])) {
+ echo '';
+ }
+ echo $app[1].'
';
+ if(isset($app[3]) && trim($app[3])) {
+ echo ''.$app[3].'';
+ }
+ echo '
';
+ }
+ fclose($handle);
+ }
+ echo $after_widget;
+ }
+
+ function update($new_instance, $old_instance) {
+ $instance = array();
+ $instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
+ return $instance;
+ }
+
+ function form($instance) {
+ if (isset($instance['title'])) {
+ $title = $instance['title'];
+ }
+ else {
+ $title = __('New title', 'text_domain');
+ }
+ ?>
+
+ + +
+ inited=false; $this->site_path=getenv('DOCUMENT_ROOT'); - wp_register_sidebar_widget('fdroid_latest', 'FDroid Latest', 'widget_fdroidlatest'); + add_action('widgets_init', function() { + register_widget('FDroidLatestWidget'); + }); } @@ -897,31 +955,6 @@ function linkify($vars) { return substr($retvar,0,-1); } -function widget_fdroidlatest($args) { - extract($args); - echo $before_widget; - echo $before_title . 'Latest Apps' . $after_title; - - $handle = fopen(getenv('DOCUMENT_ROOT').'/repo/latestapps.dat', 'r'); - if ($handle) { - while (($buffer = fgets($handle, 4096)) !== false) { - $app = explode("\t", $buffer); - echo ''; - if(isset($app[2]) && trim($app[2])) { - echo '