Dateien nach "/" hochladen
This commit is contained in:
91
mc-multiserver-gallery-pro.php
Normal file
91
mc-multiserver-gallery-pro.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/*
|
||||
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.2
|
||||
Author: M_Viper
|
||||
Text Domain: mc-multiserver-gallery-pro
|
||||
Domain Path: /languages
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
if (version_compare(PHP_VERSION, '7.0', '<')) {
|
||||
if (is_admin()) {
|
||||
add_action('admin_notices', function() {
|
||||
echo '<div class="error"><p><strong>MC Gallery PRO:</strong> Dieses Plugin benötigt PHP 7.0 oder höher.</p></div>';
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('MCGALLERY_PRO_VERSION')) { return; }
|
||||
|
||||
define('MCGALLERY_PRO_VERSION', '2.5.2');
|
||||
define('MCGALLERY_PRO_DIR', plugin_dir_path(__FILE__));
|
||||
define('MCGALLERY_PRO_URL', plugin_dir_url(__FILE__));
|
||||
define('MCGALLERY_TOKEN_TTL', 300);
|
||||
define('MCGALLERY_OPTION_KEY', 'mc_gallery_tokens_store');
|
||||
|
||||
function mc_gallery_pro_safe_require($path) {
|
||||
if (!file_exists($path)) {
|
||||
if (is_admin()) {
|
||||
add_action('admin_notices', function() use ($path) {
|
||||
echo '<div class="error"><p><strong>MC Gallery PRO Fehler:</strong> Datei nicht gefunden: <code>' . esc_html($path) . '</code>.</p></div>';
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
require_once $path;
|
||||
return true;
|
||||
}
|
||||
|
||||
function mc_gallery_pro_load_textdomain() {
|
||||
load_plugin_textdomain('mc-multiserver-gallery-pro', false, basename(dirname(__FILE__)) . '/languages');
|
||||
}
|
||||
add_action('plugins_loaded', 'mc_gallery_pro_load_textdomain');
|
||||
|
||||
$core_files = [
|
||||
'class-mc-gallery-helpers.php',
|
||||
'class-mc-gallery-core.php',
|
||||
'class-mc-gallery-shortcodes.php'
|
||||
];
|
||||
|
||||
if (!is_dir(MCGALLERY_PRO_DIR . 'includes')) {
|
||||
add_action('admin_notices', function() {
|
||||
echo '<div class="error"><p><strong>MC Gallery PRO Fehler:</strong> Der Ordner <code>includes/</code> fehlt.</p></div>';
|
||||
});
|
||||
} else {
|
||||
foreach ($core_files as $file) {
|
||||
if (!mc_gallery_pro_safe_require(MCGALLERY_PRO_DIR . 'includes/' . $file)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mc_gallery_pro_activate_callback() {
|
||||
if (class_exists('MC_Gallery_Core')) {
|
||||
if (!get_option(MC_Gallery_Core::OPTION_THUMB_H)) {
|
||||
update_option(MC_Gallery_Core::OPTION_THUMB_H, 200);
|
||||
}
|
||||
}
|
||||
if (get_option(MCGALLERY_OPTION_KEY) === false) {
|
||||
update_option(MCGALLERY_OPTION_KEY, []);
|
||||
}
|
||||
}
|
||||
register_activation_hook(__FILE__, 'mc_gallery_pro_activate_callback');
|
||||
|
||||
function mc_gallery_pro_uninstall_callback() {
|
||||
delete_option(MCGALLERY_OPTION_KEY);
|
||||
if (class_exists('MC_Gallery_Core')) {
|
||||
delete_option(MC_Gallery_Core::OPTION_THUMB_H);
|
||||
}
|
||||
}
|
||||
register_uninstall_hook(__FILE__, 'mc_gallery_pro_uninstall_callback');
|
||||
|
||||
if (class_exists('MC_Gallery_Core')) {
|
||||
add_action('plugins_loaded', ['MC_Gallery_Core', 'init']);
|
||||
}
|
||||
if (class_exists('MC_Gallery_Shortcodes')) {
|
||||
add_action('plugins_loaded', ['MC_Gallery_Shortcodes', 'init']);
|
||||
}
|
||||
Reference in New Issue
Block a user