/** * Get all available categories * @return array */ public function listCategories() { $categories = array(array('id' => 0, 'displayName' => (string) $this->l10n->t('Enabled')), array('id' => 1, 'displayName' => (string) $this->l10n->t('Not enabled'))); if ($this->config->getSystemValue('appstoreenabled', true)) { $categories[] = array('id' => 2, 'displayName' => (string) $this->l10n->t('Recommended')); // apps from external repo via OCS $ocs = \OC_OCSClient::getCategories(); foreach ($ocs as $k => $v) { $categories[] = array('id' => $k, 'displayName' => str_replace('ownCloud ', '', $v)); } } $categories['status'] = 'success'; return $categories; }
/** * get a list of all apps on apps.owncloud.com * @return array, multi-dimensional array of apps. * Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ public static function getAppstoreApps($filter = 'approved', $category = null) { $categories = array($category); if (is_null($category)) { $categoryNames = OC_OCSClient::getCategories(); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!($categories = array_keys($categoryNames))) { return false; } } else { return false; } } $page = 0; $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); $app1 = array(); $i = 0; $l = \OC::$server->getL10N('core'); foreach ($remoteApps as $app) { $potentialCleanId = self::getInternalAppIdByOcs($app['id']); // enhance app info (for example the description) $app1[$i] = OC_App::parseAppInfo($app); $app1[$i]['author'] = $app['personid']; $app1[$i]['ocs_id'] = $app['id']; $app1[$i]['internal'] = 0; $app1[$i]['active'] = $potentialCleanId !== false ? self::isEnabled($potentialCleanId) : false; $app1[$i]['update'] = false; $app1[$i]['groups'] = false; $app1[$i]['score'] = $app['score']; $app1[$i]['removable'] = false; if ($app['label'] == 'recommended') { $app1[$i]['internallabel'] = (string) $l->t('Recommended'); $app1[$i]['internalclass'] = 'recommendedapp'; } $i++; } if (empty($app1)) { return false; } else { return $app1; } }
* See the COPYING-README file. */ // Init owncloud require_once '../../../lib/base.php'; OC_JSON::checkAdminUser(); $l = OC_L10N::get('settings'); if (OC_Config::getValue('appstoreenabled', true) == false) { OCP\JSON::success(array('type' => 'external', 'data' => array())); } $enabledApps = OC_App::getEnabledApps(); if (is_null($enabledApps)) { OCP\JSON::error(array('data' => array('message' => $l->t('Unable to load list from App Store')))); } $apps = array(); // apps from external repo via OCS $catagoryNames = OC_OCSClient::getCategories(); if (is_array($catagoryNames)) { $categories = array_keys($catagoryNames); $page = 0; $filter = 'approved'; $externalApps = OC_OCSClient::getApplications($categories, $page, $filter); foreach ($externalApps as $app) { // show only external apps that aren't enabled yet $local = false; foreach ($enabledApps as $a) { if ($a == $app['name']) { $local = true; } } if (!$local) { if ($app['preview'] == '') {
/** * @brief: get a list of all apps on apps.owncloud.com * @return array, multi-dimensional array of apps. * Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ public static function getAppstoreApps($filter = 'approved') { $categoryNames = OC_OCSClient::getCategories(\OC_Util::getVersion()); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!($categories = array_keys($categoryNames))) { return false; } $page = 0; $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter, \OC_Util::getVersion()); $app1 = array(); $i = 0; foreach ($remoteApps as $app) { $app1[$i] = $app; $app1[$i]['author'] = $app['personid']; $app1[$i]['ocs_id'] = $app['id']; $app1[$i]['internal'] = $app1[$i]['active'] = 0; $app1[$i]['update'] = false; if ($app['label'] == 'recommended') { $app1[$i]['internallabel'] = 'Recommended'; $app1[$i]['internalclass'] = 'recommendedapp'; } else { $app1[$i]['internallabel'] = '3rd Party'; $app1[$i]['internalclass'] = 'externalapp'; } // rating img if ($app['score'] >= 0 and $app['score'] < 5) { $img = OC_Helper::imagePath("core", "rating/s1.png"); } elseif ($app['score'] >= 5 and $app['score'] < 15) { $img = OC_Helper::imagePath("core", "rating/s2.png"); } elseif ($app['score'] >= 15 and $app['score'] < 25) { $img = OC_Helper::imagePath("core", "rating/s3.png"); } elseif ($app['score'] >= 25 and $app['score'] < 35) { $img = OC_Helper::imagePath("core", "rating/s4.png"); } elseif ($app['score'] >= 35 and $app['score'] < 45) { $img = OC_Helper::imagePath("core", "rating/s5.png"); } elseif ($app['score'] >= 45 and $app['score'] < 55) { $img = OC_Helper::imagePath("core", "rating/s6.png"); } elseif ($app['score'] >= 55 and $app['score'] < 65) { $img = OC_Helper::imagePath("core", "rating/s7.png"); } elseif ($app['score'] >= 65 and $app['score'] < 75) { $img = OC_Helper::imagePath("core", "rating/s8.png"); } elseif ($app['score'] >= 75 and $app['score'] < 85) { $img = OC_Helper::imagePath("core", "rating/s9.png"); } elseif ($app['score'] >= 85 and $app['score'] < 95) { $img = OC_Helper::imagePath("core", "rating/s10.png"); } elseif ($app['score'] >= 95 and $app['score'] < 100) { $img = OC_Helper::imagePath("core", "rating/s11.png"); } $app1[$i]['score'] = '<img src="' . $img . '"> Score: ' . $app['score'] . '%'; $i++; } } if (empty($app1)) { return false; } else { return $app1; } }
/** * get a list of all apps on apps.owncloud.com * @return array, multi-dimensional array of apps. * Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ public static function getAppstoreApps($filter = 'approved', $category = null) { $categories = array($category); if (is_null($category)) { $categoryNames = OC_OCSClient::getCategories(); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!($categories = array_keys($categoryNames))) { return false; } } else { return false; } } $page = 0; $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); $app1 = array(); $i = 0; $l = \OC::$server->getL10N('core'); foreach ($remoteApps as $app) { $app1[$i] = $app; $app1[$i]['author'] = $app['personid']; $app1[$i]['ocs_id'] = $app['id']; $app1[$i]['internal'] = $app1[$i]['active'] = 0; $app1[$i]['update'] = false; $app1[$i]['groups'] = false; $app1[$i]['score'] = $app['score']; $app1[$i]['removable'] = false; if ($app['label'] == 'recommended') { $app1[$i]['internallabel'] = $l->t('Recommended'); $app1[$i]['internalclass'] = 'recommendedapp'; } $i++; } if (empty($app1)) { return false; } else { return $app1; } }
* This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OC_JSON::checkAdminUser(); $l = OC_L10N::get('settings'); if (OC_Config::getValue('appstoreenabled', true) == false) { OCP\JSON::success(array('type' => 'external', 'data' => array())); } $enabledApps = OC_App::getEnabledApps(); if (is_null($enabledApps)) { OCP\JSON::error(array('data' => array('message' => $l->t('Unable to load list from App Store')))); } $apps = array(); // apps from external repo via OCS $categoryNames = OC_OCSClient::getCategories(\OC_Util::getVersion()); if (is_array($categoryNames)) { $categories = array_keys($categoryNames); $page = 0; $filter = 'approved'; $externalApps = OC_OCSClient::getApplications($categories, $page, $filter, \OC_Util::getVersion()); foreach ($externalApps as $app) { // show only external apps that aren't enabled yet $local = false; foreach ($enabledApps as $a) { if ($a === $app['name']) { $local = true; } } if (!$local) { if ($app['preview'] === '') {