diff --git a/README.md b/README.md
index b02ea13..a0616d7 100644
--- a/README.md
+++ b/README.md
@@ -14,12 +14,16 @@ This plugin is designed for:
## Features
+- **Multi-Project Support**: Save and manage multiple GitHub projects in one place
+- **Project Cards**: Visual card-based interface showing all your saved projects
+- **One-Click Sync**: Synchronize any saved project to pull the latest version from Git
- Install plugins directly from public or private GitHub repositories
- Update existing plugins installed from GitHub
- Preview repository contents before installation
- Select specific versions (tags) of a plugin to install
- Support for private repositories using GitHub Personal Access Tokens
- Automatic plugin folder naming based on the repository name
+- Track last synchronization time for each project
## Installation
@@ -29,12 +33,33 @@ This plugin is designed for:
## Usage
+### Installing a New Plugin
+
1. In the WordPress admin panel, go to Plugins > GitHub Installer.
-2. Enter the GitHub repository URL of the plugin you want to install.
-3. If it's a private repository, check the "Private Repository?" box and enter your GitHub Personal Access Token.
-4. The plugin will fetch available versions and provide a preview of the repository contents.
-5. Select the version you want to install from the dropdown menu.
-6. Click "Install/Update Plugin" to proceed with the installation or update.
+2. Enter a project name (optional) to save the project for later use.
+3. Enter the GitHub repository URL of the plugin you want to install.
+4. If it's a private repository, check the "Private Repository?" box and enter your GitHub Personal Access Token.
+5. The plugin will fetch available versions and provide a preview of the repository contents.
+6. Select the version you want to install from the dropdown menu.
+7. Click "Install/Update Plugin" to proceed with the installation or update.
+8. Optionally, click "Als Projekt speichern" (Save as Project) to save this configuration for future use.
+
+### Managing Saved Projects
+
+Once you've saved projects, they will appear as cards below the installation form:
+
+- **View Project Details**: Each card shows the project name, repository URL, version, privacy status, and last sync time.
+- **Synchronize**: Click the "Synchronisieren" button to pull the latest version from Git for that specific project.
+- **Delete**: Click the "Löschen" button to remove a saved project from your list (this won't uninstall the plugin, just removes it from the saved projects).
+
+### Synchronizing Projects
+
+The synchronization feature allows you to quickly update any saved project:
+
+1. Find the project card you want to sync.
+2. Click the "Synchronisieren" (Synchronize) button.
+3. The plugin will automatically fetch the latest version from Git and update the plugin.
+4. You'll see a status message indicating success or failure.
## Requirements
@@ -57,8 +82,10 @@ No additional configuration is required after installation. However, for private
## Security Considerations
- The plugin uses nonces and capability checks to ensure only authorized users can install plugins.
-- Personal Access Tokens are not stored by the plugin and must be entered each time for private repositories.
+- **Personal Access Tokens are stored in the WordPress database** when you save a project. Ensure your WordPress installation is secure.
+- Only users with the `manage_options` capability (typically administrators) can access the plugin.
- Always review the contents of a repository before installing to ensure it's from a trusted source.
+- Saved projects and their tokens are stored using WordPress options API with proper sanitization.
## Limitations
diff --git a/advanced-github-plugin-installer.php b/advanced-github-plugin-installer.php
index 95552d0..ba9fb8d 100644
--- a/advanced-github-plugin-installer.php
+++ b/advanced-github-plugin-installer.php
@@ -1,8 +1,8 @@
$project_id,
+ 'name' => sanitize_text_field($project_data['name']),
+ 'repo_url' => esc_url_raw($project_data['repo_url']),
+ 'is_private' => (bool) $project_data['is_private'],
+ 'access_token' => !empty($project_data['access_token']) ? sanitize_text_field($project_data['access_token']) : '',
+ 'version' => sanitize_text_field($project_data['version']),
+ 'last_synced' => current_time('mysql')
+ );
+ update_option('github_installer_projects', $projects);
+ return $project_id;
+}
+
+function delete_project($project_id) {
+ $projects = get_saved_projects();
+ if (isset($projects[$project_id])) {
+ unset($projects[$project_id]);
+ update_option('github_installer_projects', $projects);
+ return true;
+ }
+ return false;
+}
+
function github_plugin_installer_page() {
if (!current_user_can('manage_options')) {
return;
@@ -38,46 +73,201 @@ function github_plugin_installer_page() {
$is_private = isset($_POST['is_private']) ? true : false;
$access_token = $is_private ? sanitize_text_field($_POST['access_token']) : '';
$selected_version = sanitize_text_field($_POST['version']);
-
+
install_update_github_plugin($repo_url, $access_token, $selected_version);
}
+ $saved_projects = get_saved_projects();
+
?>
+
-
-
-
Repository Preview
-
+
+
+
Neues Projekt hinzufügen
+
+
+
Repository Preview
+
+
+
+
+
Gespeicherte Projekte
+
+
+
+
+
+
Repository:
+
Version:
+
Status:
+
Zuletzt synchronisiert:
+
+
+
+
+
+
+
+
+
+
+
+
Keine gespeicherten Projekte vorhanden. Fügen Sie oben ein neues Projekt hinzu.