diff --git a/CHANGELOG.md b/CHANGELOG.md index 959f99b2d..1565f842f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,10 @@ 1. [](#improved) * It is now possible to manually specify a format for the `datetime` field [#1261](https://github.com/getgrav/grav/issues/1261) + * Allow to see plugins and themes list without internet connection. Also add a more helpful message in the "add" view [grav#1008](https://github.com/getgrav/grav/issues/1008) 1. [](#bugfix) * Fixed issue with downloaded package when installing a testing release - + # v1.2.9 ## 01/18/2017 diff --git a/classes/admin.php b/classes/admin.php index 0f328b5f6..3cc00917f 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -708,15 +708,21 @@ public function plugins($local = true) return false; } - return $local - ? $gpm->getInstalledPlugins() - : $gpm->getRepositoryPlugins()->filter(function ( - $package, - $slug - ) use ($gpm) { - return !$gpm->isPluginInstalled($slug); - }) - ; + if ($local) { + return $gpm->getInstalledPlugins(); + } else { + $plugins = $gpm->getRepositoryPlugins(); + if ($plugins) { + return $plugins->filter(function ( + $package, + $slug + ) use ($gpm) { + return !$gpm->isPluginInstalled($slug); + }); + } else { + return []; + } + } } /** @@ -734,11 +740,21 @@ public function themes($local = true) return false; } - return $local - ? $gpm->getInstalledThemes() - : $gpm->getRepositoryThemes()->filter(function ($package, $slug) use ($gpm) { - return !$gpm->isThemeInstalled($slug); - }); + if ($local) { + return $gpm->getInstalledThemes(); + } else { + $themes = $gpm->getRepositoryThemes(); + if ($themes) { + return $themes->filter(function ( + $package, + $slug + ) use ($gpm) { + return !$gpm->isThemeInstalled($slug); + }); + } else { + return []; + } + } } /** diff --git a/languages/en.yaml b/languages/en.yaml index 59411aa4a..4d23e7aed 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -632,4 +632,5 @@ PLUGIN_ADMIN: NEVER_CACHE_TWIG: "Never Cache Twig" NEVER_CACHE_TWIG_HELP: "Only cache content and process Twig every time for pages. Ignores twig_first setting." ALLOW_WEBSERVER_GZIP: "Allow WebServer Gzip" - ALLOW_WEBSERVER_GZIP_HELP: "Off by default. When enabled, WebServer-configured Gzip/Deflate compression will work, but http connection will not be closed before onShutDown() event causing slower page loading" \ No newline at end of file + ALLOW_WEBSERVER_GZIP_HELP: "Off by default. When enabled, WebServer-configured Gzip/Deflate compression will work, but http connection will not be closed before onShutDown() event causing slower page loading" + OFFLINE_WARNING: "The connection to the GPM cannot be established" \ No newline at end of file diff --git a/themes/grav/templates/partials/plugins-list.html.twig b/themes/grav/templates/partials/plugins-list.html.twig index ad09007a5..a2870813c 100644 --- a/themes/grav/templates/partials/plugins-list.html.twig +++ b/themes/grav/templates/partials/plugins-list.html.twig @@ -17,7 +17,7 @@ {% for slug, plugin in admin.plugins(not installing).toArray|ksort %} {% set data = admin.data('plugins/' ~ slug) %} {% set isTestingRelease = admin.gpm.isTestingRelease(slug) %} - {% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug).date %} + {% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug, true).date %}