diff options
author | Georg Ehrke <developer@georgehrke.com> | 2014-06-02 23:37:39 +0400 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2014-06-02 23:39:15 +0400 |
commit | eea501b847f2a4b6a8b29d4d2ded7ef86a841f42 (patch) | |
tree | a1b35a093cf9590fe2a1d019f2058f7cb5e2a3ce /lib/private/app.php | |
parent | c8a8c7e93340eaa36586926ca70c8a3959aa4a94 (diff) |
various fixes as requested by pr reviewers
Diffstat (limited to 'lib/private/app.php')
-rw-r--r-- | lib/private/app.php | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 0e2c023a9de..5e327175630 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -462,11 +462,10 @@ class OC_App{ } } - if (count($possibleApps) === 0) { + if (empty($possibleApps)) { return false; } elseif(count($possibleApps) === 1) { - reset($possibleApps); - $dir = current($possibleApps); + $dir = array_shift($possibleApps); $app_dir[$appId] = $dir; return $dir; } else { @@ -486,7 +485,6 @@ class OC_App{ } } - /** * Get the directory for the given app. * If the app is defined in multiple directories, the first one is taken. (false if not found) @@ -511,7 +509,6 @@ class OC_App{ return is_writable($path); } - /** * Get the path for the given app on the access * If the app is defined in multiple directories, the first one is taken. (false if not found) @@ -535,7 +532,6 @@ class OC_App{ return self::getAppVersionByPath($file); } - /** * get app's version based on it's path * @param string $path @@ -544,8 +540,8 @@ class OC_App{ public static function getAppVersionByPath($path) { $versionFile = $path . '/appinfo/version'; $infoFile = $path . '/appinfo/info.xml'; - if(is_file($versionFile) && $version = trim(file_get_contents($versionFile))) { - return $version; + if(is_file($versionFile)) { + return trim(file_get_contents($versionFile)); }else{ $appData=self::getAppInfo($infoFile, true); return isset($appData['version'])? $appData['version'] : ''; @@ -884,27 +880,27 @@ class OC_App{ // rating img - if ($app['score'] >= 0 && $app['score'] < 5) { + if ($app['score'] < 5) { $img = OC_Helper::imagePath( "core", "rating/s1.png" ); - } elseif ($app['score'] >= 5 && $app['score'] < 15) { + } elseif ($app['score'] < 15) { $img = OC_Helper::imagePath( "core", "rating/s2.png" ); - } elseif($app['score'] >= 15 && $app['score'] < 25) { + } elseif($app['score'] < 25) { $img = OC_Helper::imagePath( "core", "rating/s3.png" ); - } elseif($app['score'] >= 25 && $app['score'] < 35) { + } elseif($app['score'] < 35) { $img = OC_Helper::imagePath( "core", "rating/s4.png" ); - } elseif($app['score'] >= 35 && $app['score'] < 45) { + } elseif($app['score'] < 45) { $img = OC_Helper::imagePath( "core", "rating/s5.png" ); - } elseif($app['score'] >= 45 && $app['score'] < 55) { + } elseif($app['score'] < 55) { $img = OC_Helper::imagePath( "core", "rating/s6.png" ); - } elseif($app['score'] >= 55 && $app['score'] < 65) { + } elseif($app['score'] < 65) { $img = OC_Helper::imagePath( "core", "rating/s7.png" ); - } elseif($app['score'] >= 65 && $app['score'] < 75) { + } elseif($app['score'] < 75) { $img = OC_Helper::imagePath( "core", "rating/s8.png" ); - } elseif($app['score'] >= 75 && $app['score'] < 85) { + } elseif($app['score'] < 85) { $img = OC_Helper::imagePath( "core", "rating/s9.png" ); - } elseif($app['score'] >= 85 && $app['score'] < 95) { + } elseif($app['score'] < 95) { $img = OC_Helper::imagePath( "core", "rating/s10.png" ); - } elseif($app['score'] >= 95 && $app['score'] < 100) { + } elseif($app['score'] < 100) { $img = OC_Helper::imagePath( "core", "rating/s11.png" ); } @@ -1102,7 +1098,7 @@ class OC_App{ $version=OC_Util::getVersion(); if(!self::isAppCompatible($version, $info)) { throw new \Exception( - $l->t("App \"%s\" can't be installed because it is not compatible with this version of ownCloud.", + $l->t('App \"%s\" can\'t be installed because it is not compatible with this version of ownCloud.', array($info['name']) ) ); |