diff --git a/includes/system.php b/includes/system.php index 09467cf8..b0f7e21d 100755 --- a/includes/system.php +++ b/includes/system.php @@ -161,7 +161,7 @@ function getUserPlugins() $plugins = []; foreach ($submodules as $submodule) { $manifestUrl = $submodule['url'] .'/blob/master/manifest.json?raw=true'; - $manifest = getPluginManifest($manifestUrl); + $manifest = $pluginInstaller->getPluginManifest($manifestUrl); if ($manifest) { $namespace = $manifest['namespace'] ?? ''; @@ -232,36 +232,6 @@ function getSubmodules(string $repoUrl): array return $submodules; } -/** - * Decodes a plugin's associated manifest JSON. - * Returns an array of key-value pairs - * - * @param string $url - * @return array $json - */ -function getPluginManifest(string $url): ?array -{ - $options = [ - 'http' => [ - 'method' => 'GET', - 'follow_location' => 1, - ], - ]; - - $context = stream_context_create($options); - $content = file_get_contents($url, false, $context); - - if ($content === false) { - return null; - } - $json = json_decode($content, true); - - if (json_last_error() !== JSON_ERROR_NONE) { - return null; - } - return $json; -} - /** * Returns a list of available plugins formatted as an HTML table * @@ -284,8 +254,8 @@ function getHTMLPluginsTable(array $plugins): string $status = 'Installed'; } else { $status = ''; + name="install-plugin" data-bs-toggle="modal" data-bs-target="#install-user-plugin" + data-record-id="'.htmlspecialchars($plugin['plugin_uri']).'" />' . _("Install now") .''; } $name = '