diff --git a/includes/classes/class_appdata.inc b/includes/classes/class_appdata.inc
index d637b27..eaef119 100644
--- a/includes/classes/class_appdata.inc
+++ b/includes/classes/class_appdata.inc
@@ -1,310 +1,325 @@
*
* Usage:
*
*/
class AppData
{
var $data;
function AppData($name, $path = "..") {
$name = preg_replace('/[^a-z\-_0-9]/i','',$name);
$this->data = json_decode(file_get_contents($path.'/applications/apps/'.$name.'.json'), true) + json_decode(file_get_contents($path.'/applications/apps/'.$name.'_generated.json'), true);
}
function name() {
return $this->data['name'];
}
function genericName() {
return $this->data['generic name'];
}
function category() {
return $this->data['category'];
}
function descriptionHtml() {
$description = $this->data['description'];
$description = i18n_var($description);
if(substr($description, 0, 3) != '
') {
$description = '
'.$description.'
';
}
if ($this->category() == "Unmaintained") {
$description .= "".i18n_var('%1 is unmaintained and no longer released by the KDE community.', $this->name())."
";
}
return $description;
}
function listToHtml($list) {
$html = '';
$liOpen = false;
foreach($list as $item) {
if (is_array($item)) {
$html .= $this->listToHtml($item);
continue;
}
if ($liOpen)
$html .= '';
$html .= '- '.i18n_var($item);
$liOpen = true;
}
$html .= '
';
return $html;
}
function hasFeatures() {
return $this->data['features'] != false;
}
function featureHtml() {
if (is_array($this->data['features'])) {
return $this->listToHtml($this->data['features']);
} else {
return $this->data['features'];
}
}
function hasVersions() {
return false; ///TODO: version information is not yet implemented
}
function hasAuthors() {
return isset($this->data['authors']) && ($this->data['authors'] != false);
}
function authorHtml() {
$html = ''.i18n_var( "Authors:" ).'
';
$html .= '';
if (count($this->data['credits'])) {
$html .= ''.i18n_var( "Thanks To:" ).'
';
$html .= '';
}
return $html;
}
function hasLicense() {
return isset($this->data['license']) && ($this->data['license'] != false);
}
function licenseHtml() {
$license = $this->data['license'];
$text = '';
switch($license) {
case 'GPL': case 'GPL_V2':
$text .= i18n_var('%1 is distributed under the terms of the GNU General Public License (GPL), Version 2.', $this->name());
break;
case 'GPL_V3':
$text .= i18n_var('%1 is distributed under the terms of the GNU General Public License (GPL), Version 3.', $this->name());
break;
case 'LGPL':
$text .= i18n_var('%1 is distributed under the terms of the GNU Library General Public License, version 2.', $this->name());
break;
default:
$text .= $license.'.';
}
$text .= '
';
return $text;
}
function hasHomepage() {
return $this->data['homepage'] != false;
}
function homepage() {
return $this->data['homepage'];
}
function hasAppStream() {
return isset($this->data['appstream']) && ($this->data['appstream'] != false);
}
function AppStreamId() {
return $this->data['appstream'];
}
function hasKDEApps() {
return $this->data['kde-apps.org'] != false;
}
function KDEAppsId() {
return $this->data['kde-apps.org'];
}
function hasUserbase() {
return $this->data['userbase'] != false;
}
function userbase() {
return "http://userbase.kde.org/".$this->data['userbase'];
}
function hasHandbook() {
return $this->data['handbook'] != false;
}
function handbook() {
return $this->data['handbook'];
}
function forumUrl() {
if ($this->data['forum'] != false) {
return 'http://forum.kde.org/viewforum.php?f='.$this->data['forum'];
} else {
return 'http://forum.kde.org/';
}
}
function ircChannels() {
if ($this->data['irc'] != false) {
$irc = $this->data['irc'];
if (is_array($irc)) {
return $irc;
} else {
return array($irc);
}
} else {
return array("#kde");
}
}
function mailingLists() {
if ($this->data['mailing lists'] != false) {
$ml = $this->data['mailing lists'];
if (is_array($ml)) {
return $ml;
} else {
return array($ml);
}
} else {
return array("kde@kde.org");
}
}
function browseSourcesHtml() {
if ($this->data['repository'][0] == 'svn') {
return ''.i18n_var("Browse %1 source code on WebSVN", $this->name()).'
';
} else if($this->data['repository'][0] == 'git') {
$path = ''.i18n_var("Browse %1 source code online", $this->name()).'
';
return $path;
}
return '';
}
function checkoutSourcesHtml() {
if ($this->data['repository'][0] == 'svn') {
return ''.i18n_var("Checkout source code:", $this->name()).'
svn co svn://anonsvn.kde.org/home/kde/'.$this->data['repository'][1].'
';
} else if($this->data['repository'][0] == 'git') {
return ''.i18n_var("Clone %1 source code:", $this->name()).'
git clone git://anongit.kde.org/'.$this->data['repository'][1].'
';
}
return '';
}
+ function hasCi() {
+ return $this->data['ci'] != false;
+ }
+
+ function ciUrl() {
+ if (is_array($this->data['ci'])) {
+ $group = $this->data['ci'][0];
+ $repository = $this->data['ci'][1];
+ } else {
+ $group = $this->data['ci'];
+ $repository = $this->data['repository'][1];
+ }
+ return "https://build.kde.org/job/".$group."/job/".$repository."/";
+ }
+
//Returns true if the application has a bugtracker (external or KDE bugzilla)
function hasBugTracker() {
return $this->data['bugs'] != false;
}
//Returns true if the application has an external bugtracker (!bugs.k.o)
function isBugTrackerExternal() {
return (substr($this->data['bugs'], 0, 7) == "http://" ||
substr($this->data['bugs'], 0, 8) == "https://");
}
function bugzillaProduct() {
if (is_array($this->data['bugs'])) {
return $this->data['bugs'][0];
}
return $this->data['bugs'];
}
function bugzillaComponent() {
if (is_array($this->data['bugs'])) {
return $this->data['bugs'][1];
}
return false;
}
function hasEbn() {
return true;
}
function ebnUrlBase() {
// examples:
// KDE/kdeedu/parley: http://englishbreakfastnetwork.org/krazy/reports/kde-4.x/kdeedu/parley/index.html
// KDE/kdebase/apps/dolphin: http://englishbreakfastnetwork.org/krazy/reports/kde-4.x/kdebase-apps/dolphin/index.html
// extragear/graphics/digikam: http://englishbreakfastnetwork.org/krazy/reports/extragear/graphics/digikam/index.html
// koffice/kword: http://englishbreakfastnetwork.org/krazy/reports/bundled-apps/koffice/kword/index.html
// amarok (gitorious): http://englishbreakfastnetwork.org/krazy/reports/extragear/multimedia/amarok-git/index.html
$ebn = '';
if ($this->data['repository'][0] == 'svn') {
$parts = explode ('/', $this->data['repository'][1]);
$len = count($parts);
if (!strlen($parts[$len-1])) {
array_pop($parts);
$len--;
}
if (in_array('KDE', $parts)) {
if ($parts[$len-3] == 'kdebase') {
$ebn = 'kde-4.x/kdebase-'.$parts[$len-2].'/'.$parts[$len-1];
} else {
$ebn = 'kde-4.x/'.$parts[$len-2].'/'.$parts[$len-1];
}
} else if (in_array('extragear', $parts)) {
$ebn = 'extragear/'.$parts[$len-2].'/'.$parts[$len-1];
} else if (in_array('koffice', $parts)) {
$ebn = 'bundled-apps/'.$parts[$len-2].'/'.$parts[$len-1];
}
} else if($this->data['repository'][0] == 'git') {
// extract path segments from module parent
$parts = explode('/', $this->data['parent']);
// replace path segment by "kde-4.x" for "kde"
if ($parts[0] == 'kde') {
$ebn = "kde-4.x/" . $parts[1] . "/" . strtolower($this->data['repository'][1]);
} else {
$ebn = $parts[0] . "/" . $parts[1] . "/" . strtolower($this->name());
}
return $ebn;
}
}
function ebnCodeCheckingUrl()
{
return 'http://ebn.kde.org/krazy/reports/'.$this->ebnUrlBase().'/index.html';
}
function ebnDocCheckingUrl()
{
return 'http://ebn.kde.org/sanitizer/reports/'.$this->ebnUrlBase().'/index.html';
}
}