Upload via Git Manager GUI - mc-multiserver-gallery-pro.php

This commit is contained in:
2026-03-29 11:35:43 +00:00
parent 0ab87297ac
commit c4c02c1b9d

View File

@@ -2,8 +2,10 @@
/*
Plugin Name: MC MultiServer Gallery PRO
Description: Professionelle Minecraft-Galerie mit Ingame-Verification, modernem UI, Lightbox und AJAX-Upload (multi-server fähig).
Version: 2.5.4
Version: 2.5.5
Author: M_Viper
Plugin URI: https://git.viper.ipv64.net/M_Viper/Wordpress-MC-Gallery/releases
Author URI: https://m-viper.de
Text Domain: mc-multiserver-gallery-pro
Domain Path: /languages
*/
@@ -128,7 +130,7 @@ if (version_compare(PHP_VERSION, '7.0', '<')) {
if (defined('MCGALLERY_PRO_VERSION')) { return; }
define('MCGALLERY_PRO_VERSION', '2.5.2');
define('MCGALLERY_PRO_VERSION', '2.5.4');
define('MCGALLERY_PRO_DIR', plugin_dir_path(__FILE__));
define('MCGALLERY_PRO_URL', plugin_dir_url(__FILE__));
define('MCGALLERY_TOKEN_TTL', 300);
@@ -152,10 +154,10 @@ function mc_gallery_pro_load_textdomain() {
}
add_action('plugins_loaded', 'mc_gallery_pro_load_textdomain');
$core_files = [
$core_files = [
'class-mc-gallery-helpers.php',
'class-mc-gallery-core.php',
'class-mc-gallery-shortcodes.php'
'class-mc-gallery-shortcodes.php',
];
if (!is_dir(MCGALLERY_PRO_DIR . 'includes')) {
@@ -168,8 +170,25 @@ if (!is_dir(MCGALLERY_PRO_DIR . 'includes')) {
return;
}
}
// ── WP Business Forum — optionale Bridge ─────────────────────────────────
// Wird nur geladen wenn das Forum-Plugin ebenfalls aktiv ist.
// Keine harte Abhängigkeit — Gallery funktioniert ohne Forum genauso wie vorher.
add_action('plugins_loaded', function() {
$bridge_file = MCGALLERY_PRO_DIR . 'includes/class-mc-gallery-forum-bridge.php';
if ( file_exists($bridge_file) && class_exists('WBF_Auth') ) {
require_once $bridge_file;
MC_Gallery_Forum_Bridge::init();
// Shortcode für manuelles Einbetten des Verify-Panels auf beliebigen Seiten:
// [mc_gallery_forum_login server_id="survival"]
add_shortcode('mc_gallery_forum_login', ['MC_Gallery_Forum_Bridge', 'shortcode_verify_panel']);
}
}, 20); // Prio 20 → nach Forum (Prio 1) und Gallery-Core (Prio 10)
}
// ── Aktivierungs- / Deinstallations-Hooks ────────────────────────────────────
function mc_gallery_pro_activate_callback() {
if (class_exists('MC_Gallery_Core')) {
if (!get_option(MC_Gallery_Core::OPTION_THUMB_H)) {
@@ -190,6 +209,8 @@ function mc_gallery_pro_uninstall_callback() {
}
register_uninstall_hook(__FILE__, 'mc_gallery_pro_uninstall_callback');
// ── Core-Klassen initialisieren ───────────────────────────────────────────────
if (class_exists('MC_Gallery_Core')) {
add_action('plugins_loaded', ['MC_Gallery_Core', 'init']);
}
@@ -228,21 +249,21 @@ class MC_Daily_Image_Widget extends WP_Widget {
// Alle MC Galerien finden
$galleries = get_posts([
'post_type' => 'mc_gallery',
'numberposts' => -1,
'fields' => 'ids',
'post_status' => 'publish'
'post_type' => 'mc_gallery',
'numberposts' => -1,
'fields' => 'ids',
'post_status' => 'publish',
]);
if ( ! empty( $galleries ) ) {
// Ein zufälliges Bild aus diesen Galerien holen
$random_image = get_posts([
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent__in'=> $galleries,
'numberposts' => 1,
'orderby' => 'rand', // Zufällig wählen
'suppress_filters' => false
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent__in' => $galleries,
'numberposts' => 1,
'orderby' => 'rand',
'suppress_filters' => false,
]);
if ( ! empty( $random_image ) ) {
@@ -256,14 +277,15 @@ class MC_Daily_Image_Widget extends WP_Widget {
// 3. Bild anzeigen (wird aus Cache oder neu geladen)
if ( $image_id && wp_attachment_is_image( $image_id ) ) {
$img_src = wp_get_attachment_image_src( $image_id, 'medium' );
$img_src = wp_get_attachment_image_src( $image_id, 'medium' );
$full_src = wp_get_attachment_image_src( $image_id, 'full' );
if ( $img_src ) {
?>
<div class="mc-daily-image-container" style="text-align: center;">
<a href="<?php echo esc_url( $full_src[0] ); ?>" target="_blank" title="Vollbild anzeigen">
<img src="<?php echo esc_url( $img_src[0] ); ?>" alt="MC Bild des Tages" style="max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);" />
<img src="<?php echo esc_url( $img_src[0] ); ?>" alt="MC Bild des Tages"
style="max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);" />
</a>
</div>
<?php
@@ -293,8 +315,10 @@ class MC_Daily_Image_Widget extends WP_Widget {
// Speichern der Einstellungen
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field( $new_instance['title'] ) : 'Bild des Tages';
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) )
? sanitize_text_field( $new_instance['title'] )
: 'Bild des Tages';
return $instance;
}
}