chiark / gitweb /
Added a notice for apps with anti-features.
authorHans-Emil Skogh <hansemil@gmail.com>
Mon, 23 Jan 2012 20:07:33 +0000 (21:07 +0100)
committerHans-Emil Skogh <hansemil@gmail.com>
Mon, 23 Jan 2012 20:07:33 +0000 (21:07 +0100)
wp-fdroid/wp-fdroid.php

index 2319aa250bd29a41367a3623e2962de866a49951..fc18f6d37c4b8bba0b1c66c7ccad5a3c552f35e5 100644 (file)
@@ -144,6 +144,8 @@ class FDroid
                                                case "web":
                                                        $web=$el;
                                                        break;
+                                               case "antifeatures";
+                                                       $antifeatures=$el;
                                                case "package":
                                                        $thisapk=array();
                                                        foreach($el->children() as $pel) {
@@ -204,6 +206,15 @@ class FDroid
 
                                $out.="<p>".$desc."</p>";
 
+                               if(isset($antifeatures)) {
+                                       $antifeaturesArray = explode(',',$antifeatures);
+                                       foreach($antifeaturesArray as $antifeature) {
+                                               $antifeatureDesctiption = $this->get_antifeature_description($antifeature);
+                                               $out.='<p style="border:3px solid #CC0000;background-color:#FFDDDD;padding:5px;"><strong>'.$antifeatureDesctiption['name'].'</strong><br />';
+                                               $out.=$antifeatureDesctiption['description'].'</p>';
+                                       }
+                               }
+
                                $out.="<p><b>License:</b> ".$license."</p>";
 
                                $out.="<p>";
@@ -390,6 +401,23 @@ class FDroid
                return round($size,max(0,$i-1)).' '.$si_prefix[$i];
        }
 
+       private function get_antifeature_description($antifeature) {
+               // Anti feature names and descriptions
+               $antifeatureDesctiption['ads']['name'] = 'Advertising';
+               $antifeatureDesctiption['ads']['description'] = 'This application contains advertising';
+               $antifeatureDesctiption['tracking']['name'] = 'Tracks You';
+               $antifeatureDesctiption['tracking']['description'] = 'This application tracks and reports your activity to somewhere';
+               $antifeatureDesctiption['nonfreenet']['name'] = 'Non-Free Network Services';
+               $antifeatureDesctiption['nonfreenet']['description'] = 'This application promotes a non-Free network service';
+               $antifeatureDesctiption['nonfreeadd']['name'] = 'Non-Free Addons';
+               $antifeatureDesctiption['nonfreeadd']['description'] = 'This application promotes non-Free add-ons';
+               $antifeatureDesctiption['nonfreedep']['name'] = 'Non-Free Dependencies';
+               $antifeatureDesctiption['nonfreedep']['description'] = 'This application depends on another non-Free application';
+
+               return $antifeatureDesctiption[strtolower($antifeature)];
+       }
+
+
        function get_apps($query_vars) {
 
                $xml = simplexml_load_file($this->site_path."/repo/index.xml");