Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac87d6194a | ||
|
|
74d2a573eb | ||
|
|
600791f339 |
@@ -112,3 +112,7 @@ In den meisten Fällen liegt es an einem Caching-Problem.
|
|||||||
➡️ Bitte auch dort den Cache löschen.
|
➡️ Bitte auch dort den Cache löschen.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**Copyright © 2026 - M_Viper - Alle Rechte vorbehalten**
|
||||||
|
|
||||||
|
Die unbefugte Vervielfältigung, Verbreitung oder Weitergabe dieses Plugins ist strafbar und wird rechtlich verfolgt.
|
||||||
+116
-1
@@ -1,15 +1,130 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Festive Seasons Pro
|
Plugin Name: Festive Seasons Pro
|
||||||
|
Plugin URI: https://git.viper.ipv64.net/M_Viper/Festive-Seasons-Pro
|
||||||
Description: Zeigt saisonale Effekte (Schnee, Eier, Spinnen, Ballons, Feuerwerk) für feste Feiertage und individuelle Geburtstage an.
|
Description: Zeigt saisonale Effekte (Schnee, Eier, Spinnen, Ballons, Feuerwerk) für feste Feiertage und individuelle Geburtstage an.
|
||||||
Version: 1.1
|
Version: 1.2
|
||||||
Author: M_Viper
|
Author: M_Viper
|
||||||
|
Author URI: https://m-viper.de
|
||||||
|
Requires at least: 6.8
|
||||||
|
Tested up to: 6.8
|
||||||
|
PHP Version: 7.4
|
||||||
|
License: GPL2
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
Text Domain: Festive-Seasons-Pro
|
||||||
|
Tags: seasonal, festive, christmas, easter, halloween, new year, birthdays, celebrations, snow, confetti, fireworks
|
||||||
|
Support: [Discord Support](https://discord.com/invite/FdRs4BRd8D)
|
||||||
|
Support: [Telegram Support](https://t.me/M_Viper04)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === FESTIVE SEASONS PRO - UPDATE SYSTEM ===
|
||||||
|
|
||||||
|
// Aktuelle Plugin-Version aus Plugin-Header lesen
|
||||||
|
function fsp_get_plugin_version() {
|
||||||
|
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin_data = get_plugin_data( __FILE__ );
|
||||||
|
return $plugin_data['Version'] ?? '0.0.0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache löschen (manueller Refresh)
|
||||||
|
function fsp_clear_update_cache() {
|
||||||
|
if ( isset($_GET['fsp_clear_cache']) && current_user_can('manage_options') ) {
|
||||||
|
check_admin_referer('fsp_clear_cache_action');
|
||||||
|
delete_transient('fsp_latest_release');
|
||||||
|
wp_redirect( admin_url('plugins.php') );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('admin_init', 'fsp_clear_update_cache');
|
||||||
|
|
||||||
|
// Neueste Release-Infos von Gitea holen
|
||||||
|
function fsp_get_latest_release_info( $force_refresh = false ) {
|
||||||
|
$transient_key = 'fsp_latest_release';
|
||||||
|
|
||||||
|
if ( $force_refresh ) {
|
||||||
|
delete_transient( $transient_key );
|
||||||
|
}
|
||||||
|
|
||||||
|
$release_info = get_transient( $transient_key );
|
||||||
|
|
||||||
|
if ( false === $release_info ) {
|
||||||
|
$response = wp_remote_get(
|
||||||
|
'https://git.viper.ipv64.net/api/v1/repos/M_Viper/Festive-Seasons-Pro/releases/latest',
|
||||||
|
['timeout' => 10]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! is_wp_error($response) && 200 === wp_remote_retrieve_response_code($response) ) {
|
||||||
|
$body = wp_remote_retrieve_body($response);
|
||||||
|
$data = json_decode($body, true);
|
||||||
|
|
||||||
|
if ( $data && isset($data['tag_name']) ) {
|
||||||
|
$tag = ltrim($data['tag_name'], 'v');
|
||||||
|
|
||||||
|
$release_info = [
|
||||||
|
'version' => $tag,
|
||||||
|
'download_url' => $data['zipball_url'] ?? '',
|
||||||
|
'notes' => $data['body'] ?? '',
|
||||||
|
'published_at' => $data['published_at'] ?? '',
|
||||||
|
];
|
||||||
|
|
||||||
|
set_transient( $transient_key, $release_info, 6 * HOUR_IN_SECONDS );
|
||||||
|
} else {
|
||||||
|
set_transient( $transient_key, [], HOUR_IN_SECONDS );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set_transient( $transient_key, [], HOUR_IN_SECONDS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $release_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin-Notice für Plugin-Update
|
||||||
|
function fsp_show_update_notice() {
|
||||||
|
if ( ! current_user_can('manage_options') ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_version = fsp_get_plugin_version();
|
||||||
|
$latest_release = fsp_get_latest_release_info();
|
||||||
|
|
||||||
|
if ( ! empty($latest_release['version']) && version_compare($current_version, $latest_release['version'], '<') ) {
|
||||||
|
$refresh_url = wp_nonce_url(
|
||||||
|
admin_url('plugins.php?fsp_clear_cache=1'),
|
||||||
|
'fsp_clear_cache_action'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<div class="notice notice-warning is-dismissible">
|
||||||
|
<h3>Festive Seasons Pro – Update verfügbar</h3>
|
||||||
|
<p>
|
||||||
|
Aktuelle Version: <strong><?php echo esc_html($current_version); ?></strong><br>
|
||||||
|
Neueste Version: <strong><?php echo esc_html($latest_release['version']); ?></strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="<?php echo esc_url($latest_release['download_url']); ?>" class="button button-primary" target="_blank">
|
||||||
|
Update herunterladen
|
||||||
|
</a>
|
||||||
|
<a href="https://git.viper.ipv64.net/M_Viper/Festive-Seasons-Pro/releases" class="button" target="_blank">
|
||||||
|
Release Notes
|
||||||
|
</a>
|
||||||
|
<a href="<?php echo esc_url($refresh_url); ?>" class="button">
|
||||||
|
Jetzt neu prüfen
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('admin_notices', 'fsp_show_update_notice');
|
||||||
|
|
||||||
|
|
||||||
class Festive_Seasons_Pro {
|
class Festive_Seasons_Pro {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|||||||
Reference in New Issue
Block a user