Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings page #2

Merged
merged 4 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions admin/assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ table.cpm tr:hover {

table.cpm th {
border: 1px solid #ddd;
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #3b4e9a;
color: white;
padding-left: 5px;
padding: 12px 5px;
}

table.cpm tr.out-of-date {
background: #e98a8a;
}
21 changes: 18 additions & 3 deletions admin/src/SettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,30 @@ public final function settingsPage(): void
<tr>
<th>Plugin</th>
<th>Connection Status to Repo</th>
<th>Newest Version</th>
<th>Current Version</th>
</tr>
</thead>
<tbody>
<?php
foreach ( $responses as $name => $respons ) {
foreach ( $responses as $name => $data ) {
$response = $data['response'];
$plugin_data = $data['plugin_data'];

$out_of_date = false;
if ( ! empty( $response['tag_name'] ) ) {
$out_of_date = version_compare( $response['tag_name'], $plugin_data['Version'], 'gt' );
}
?>
<tr>
<tr class="<?= $out_of_date ? 'out-of-date' : ''; ?>">
<td><?= $name; ?></td>
<td><?= ( ! empty( $respons ) && is_array( $respons ) ? 'connected' : ( ! empty( $respons ) ? $respons : 'no release found' ) ); ?></td>
<td><?= ( ! empty( $response ) && is_array( $response ) ? 'connected' : ( ! empty( $response ) ? $response : 'no release found' ) ); ?></td>
<td>
<?= ! empty( $response['tag_name'] ) ? $response['tag_name'] : 'Not version Found'; ?>
</td>
<td>
<?= $plugin_data['Version']; ?>
</td>
</tr>
<?php } ?>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion cerberus-plugins-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Plugin Name: Cerberus Plugins Manager
* Description: Manages the cerberus plugins
* Version: 1.0.0
* Version: 1.0.1
* Requires at least: 5.7
* Author: Casey
*/
Expand Down