feat: plugin-icon einbinden (auto-erkennung in assets/) (v1.5.1)
CB_Updater::icons() liefert das plugin-icon fuer den Aktualisierungen-screen und das "Versionsdetails"-popup. Es erkennt automatisch eine icon-datei in assets/ (icon.svg|png|webp|jpg); ohne datei wird kein icon gesetzt. Bild wird vom betreiber selbst hinzugefuegt (nicht im repo). + version 1.5.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: GDPR Content Blocker
|
||||
* Plugin URI: https://lucas-orth.de
|
||||
* Plugin URI: https://lucas-orth.de/wp-plugins/gdpr-content-blocker/
|
||||
* Description: DSGVO-konformer Consent-Blocker für externe iframes. Lädt Drittinhalte erst nach aktiver Einwilligung.
|
||||
* Version: 1.5.0
|
||||
* Version: 1.5.1
|
||||
* Author: Lucas Orth
|
||||
* Author URI: https://lucas-orth.de
|
||||
* Text Domain: gdpr-content-blocker
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
define( 'CB_VERSION', '1.5.0' );
|
||||
define( 'CB_VERSION', '1.5.1' );
|
||||
define( 'CB_FILE', __FILE__ );
|
||||
define( 'CB_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'CB_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
@@ -72,6 +72,25 @@ class CB_Updater {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin icon (shown on the Updates screen + the "View details" popup).
|
||||
* Auto-detects a bundled icon file in /assets — drop in ONE of:
|
||||
* assets/icon.svg | assets/icon.png | assets/icon.webp | assets/icon.jpg
|
||||
* Returns an empty array (no icon) if none is present.
|
||||
*/
|
||||
private static function icons(): array {
|
||||
foreach ( [ 'icon.svg', 'icon.png', 'icon.webp', 'icon.jpg' ] as $file ) {
|
||||
if ( file_exists( CB_DIR . 'assets/' . $file ) ) {
|
||||
$url = CB_URL . 'assets/' . $file;
|
||||
if ( str_ends_with( $file, '.svg' ) ) {
|
||||
return [ 'svg' => $url ];
|
||||
}
|
||||
return [ '1x' => $url, '2x' => $url, 'default' => $url ];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/** Inject the update into the plugins update transient. */
|
||||
public static function inject( mixed $transient ): mixed {
|
||||
if ( ! is_object( $transient ) ) {
|
||||
@@ -97,7 +116,7 @@ class CB_Updater {
|
||||
'tested' => (string) ( $info['tested'] ?? '' ),
|
||||
'requires' => (string) ( $info['requires'] ?? '' ),
|
||||
'requires_php'=> (string) ( $info['requires_php'] ?? '' ),
|
||||
'icons' => [],
|
||||
'icons' => self::icons(),
|
||||
'banners' => [],
|
||||
];
|
||||
|
||||
@@ -131,6 +150,7 @@ class CB_Updater {
|
||||
'tested' => (string) ( $info['tested'] ?? '' ),
|
||||
'requires_php' => (string) ( $info['requires_php'] ?? '' ),
|
||||
'download_link' => esc_url_raw( $info['package'] ?? '' ),
|
||||
'icons' => self::icons(),
|
||||
'sections' => [
|
||||
'changelog' => wp_kses_post( $info['changelog'] ?? '' ),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user