Compare commits
No commits in common. "main" and "1.0.8" have entirely different histories.
@ -3,12 +3,11 @@
|
|||||||
* Plugin Name: WP Multi Toolkit
|
* Plugin Name: WP Multi Toolkit
|
||||||
* Plugin URI: https://git.viper.ipv64.net/M_Viper/wp-multi-toolkit
|
* Plugin URI: https://git.viper.ipv64.net/M_Viper/wp-multi-toolkit
|
||||||
* Description: Ein umfassendes Toolkit inklusive WP Multi Funktionen und Update-Management für zugehörige Plugins.
|
* Description: Ein umfassendes Toolkit inklusive WP Multi Funktionen und Update-Management für zugehörige Plugins.
|
||||||
* Version: 1.0.9
|
* Version: 1.0.8
|
||||||
* Author: M_Viper
|
* Author: M_Viper
|
||||||
* Author URI: https://m-viper.de
|
* Author URI: https://m-viper.de
|
||||||
* Requires at least: 6.7.2
|
* Requires at least: 6.7.2
|
||||||
* Tested up to: 6.7.2
|
* Tested up to: 6.7.2
|
||||||
* Requires PHP: 7.4
|
|
||||||
* License: GPL2
|
* License: GPL2
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* Text Domain: wp-multi-toolkit
|
* Text Domain: wp-multi-toolkit
|
||||||
@ -105,11 +104,9 @@ defined('ABSPATH') or die('No direct access allowed.');
|
|||||||
* Löscht ein Backup aus dem Backup-Verzeichnis.
|
* Löscht ein Backup aus dem Backup-Verzeichnis.
|
||||||
*/
|
*/
|
||||||
function wpmt_delete_backup() {
|
function wpmt_delete_backup() {
|
||||||
if (!current_user_can('manage_options')) {
|
|
||||||
wp_die(__('Du hast nicht die Berechtigung, diese Aktion auszuführen.', 'wp-multi-toolkit'));
|
|
||||||
}
|
|
||||||
if (isset($_POST['wpmt_action']) && $_POST['wpmt_action'] === 'delete_backup' && isset($_POST['backup_file']) && check_admin_referer('wpmt_delete_backup_nonce')) {
|
if (isset($_POST['wpmt_action']) && $_POST['wpmt_action'] === 'delete_backup' && isset($_POST['backup_file']) && check_admin_referer('wpmt_delete_backup_nonce')) {
|
||||||
$backup_file = WPMT_BACKUP_DIR . sanitize_file_name($_POST['backup_file']);
|
$backup_file = WPMT_BACKUP_DIR . sanitize_file_name($_POST['backup_file']);
|
||||||
|
|
||||||
if (file_exists($backup_file)) {
|
if (file_exists($backup_file)) {
|
||||||
unlink($backup_file);
|
unlink($backup_file);
|
||||||
echo '<div class="updated"><p>' . __('Backup erfolgreich gelöscht!', 'wp-multi-toolkit') . '</p></div>';
|
echo '<div class="updated"><p>' . __('Backup erfolgreich gelöscht!', 'wp-multi-toolkit') . '</p></div>';
|
||||||
@ -117,7 +114,7 @@ defined('ABSPATH') or die('No direct access allowed.');
|
|||||||
echo '<div class="error"><p>' . __('Backup-Datei nicht gefunden.', 'wp-multi-toolkit') . '</p></div>';
|
echo '<div class="error"><p>' . __('Backup-Datei nicht gefunden.', 'wp-multi-toolkit') . '</p></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plant automatische Backups via Cron-Job.
|
* Plant automatische Backups via Cron-Job.
|
||||||
@ -646,89 +643,67 @@ function wpmt_cookie_banner_settings_page() {
|
|||||||
|
|
||||||
// DSGVO-konforme Cookie Banner Darstellung
|
// DSGVO-konforme Cookie Banner Darstellung
|
||||||
function wpmt_cookie_banner() {
|
function wpmt_cookie_banner() {
|
||||||
if (get_option('wpmt_enable_cookie_banner', '1') !== '1' || isset($_COOKIE['wpmt_cookie_accepted'])) {
|
// Überprüfen, ob der Cookie-Banner aktiv ist
|
||||||
|
$enabled = get_option('wpmt_enable_cookie_banner', '1');
|
||||||
|
if ($enabled !== '1') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Überprüfen, ob der Benutzer schon zugestimmt hat
|
||||||
|
if( isset($_COOKIE['wpmt_cookie_accepted']) ) {
|
||||||
|
return; // Banner wird nicht angezeigt, wenn der Nutzer zugestimmt hat
|
||||||
|
}
|
||||||
|
|
||||||
|
// Banner-Inhalte aus den Optionen
|
||||||
$banner_text = get_option('wpmt_cookie_banner_text', __('Wir verwenden Cookies, um Ihnen das beste Erlebnis zu bieten.', 'wp-multi-toolkit'));
|
$banner_text = get_option('wpmt_cookie_banner_text', __('Wir verwenden Cookies, um Ihnen das beste Erlebnis zu bieten.', 'wp-multi-toolkit'));
|
||||||
$accept_text = get_option('wpmt_cookie_accept_text', __('Akzeptieren', 'wp-multi-toolkit'));
|
$accept_text = get_option('wpmt_cookie_accept_text', __('Akzeptieren', 'wp-multi-toolkit'));
|
||||||
$decline_text = get_option('wpmt_cookie_decline_text', __('Ablehnen', 'wp-multi-toolkit'));
|
$decline_text = get_option('wpmt_cookie_decline_text', __('Ablehnen', 'wp-multi-toolkit'));
|
||||||
$settings_text = __('Einstellungen', 'wp-multi-toolkit');
|
|
||||||
$policy_url = get_option('wpmt_cookie_policy_url', '');
|
$policy_url = get_option('wpmt_cookie_policy_url', '');
|
||||||
$impressum_url = get_option('wpmt_cookie_impressum_url', '');
|
$impressum_url = get_option('wpmt_cookie_impressum_url', '');
|
||||||
$banner_background_color = get_option('wpmt_cookie_banner_background_color', '#f0f0f0');
|
$banner_background_color = get_option('wpmt_cookie_banner_background_color', '#f0f0f0');
|
||||||
|
|
||||||
$banner_style = 'position:fixed; bottom:0; left:0; width:100%; background:' . esc_attr($banner_background_color) . '; padding:10px; text-align:center; z-index:1000;';
|
// Banner Style
|
||||||
?>
|
$banner_style = 'position:fixed; bottom:0; left:0; width:100%; background:' . esc_attr( $banner_background_color ) . '; padding:10px; text-align:center; z-index:1000;';
|
||||||
<div style="<?php echo $banner_style; ?>" id="cookie-banner">
|
|
||||||
<p><?php echo esc_html($banner_text); ?> <a href="<?php echo esc_url($policy_url); ?>"><?php _e('Mehr erfahren', 'wp-multi-toolkit'); ?></a> | <a href="<?php echo esc_url($impressum_url); ?>"><?php _e('Impressum', 'wp-multi-toolkit'); ?></a></p>
|
|
||||||
<button id="accept-cookies" class="button"><?php echo esc_html($accept_text); ?></button>
|
|
||||||
<button id="decline-cookies" class="button"><?php echo esc_html($decline_text); ?></button>
|
|
||||||
<button id="settings-cookies" class="button"><?php echo esc_html($settings_text); ?></button>
|
|
||||||
</div>
|
|
||||||
<div id="cookie-settings" style="display:none; position:fixed; bottom:0; left:0; width:100%; background:#fff; padding:20px; z-index:1001;">
|
|
||||||
<h3><?php _e('Cookie-Einstellungen', 'wp-multi-toolkit'); ?></h3>
|
|
||||||
<label><input type="checkbox" name="cookie_necessary" checked disabled> <?php _e('Notwendig', 'wp-multi-toolkit'); ?></label><br>
|
|
||||||
<label><input type="checkbox" name="cookie_preferences"> <?php _e('Präferenzen', 'wp-multi-toolkit'); ?></label><br>
|
|
||||||
<label><input type="checkbox" name="cookie_statistics"> <?php _e('Statistiken', 'wp-multi-toolkit'); ?></label><br>
|
|
||||||
<label><input type="checkbox" name="cookie_marketing"> <?php _e('Marketing', 'wp-multi-toolkit'); ?></label><br>
|
|
||||||
<button id="save-cookie-settings" class="button button-primary"><?php _e('Speichern', 'wp-multi-toolkit'); ?></button>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
document.getElementById('accept-cookies').addEventListener('click', function() {
|
|
||||||
document.cookie = "wpmt_cookie_accepted=true; path=/; max-age=" + (60 * 60 * 24 * 365);
|
|
||||||
document.getElementById('cookie-banner').style.display = 'none';
|
|
||||||
saveConsent(true);
|
|
||||||
});
|
|
||||||
document.getElementById('decline-cookies').addEventListener('click', function() {
|
|
||||||
document.getElementById('cookie-banner').style.display = 'none';
|
|
||||||
saveConsent(false);
|
|
||||||
});
|
|
||||||
document.getElementById('settings-cookies').addEventListener('click', function() {
|
|
||||||
document.getElementById('cookie-settings').style.display = 'block';
|
|
||||||
});
|
|
||||||
document.getElementById('save-cookie-settings').addEventListener('click', function() {
|
|
||||||
var settings = {
|
|
||||||
necessary: true,
|
|
||||||
preferences: document.querySelector('[name="cookie_preferences"]').checked,
|
|
||||||
statistics: document.querySelector('[name="cookie_statistics"]').checked,
|
|
||||||
marketing: document.querySelector('[name="cookie_marketing"]').checked
|
|
||||||
};
|
|
||||||
document.cookie = "wpmt_cookie_accepted=" + JSON.stringify(settings) + "; path=/; max-age=" + (60 * 60 * 24 * 365);
|
|
||||||
document.getElementById('cookie-banner').style.display = 'none';
|
|
||||||
document.getElementById('cookie-settings').style.display = 'none';
|
|
||||||
saveConsent(settings);
|
|
||||||
});
|
|
||||||
|
|
||||||
function saveConsent(settings) {
|
// HTML für den Cookie-Banner
|
||||||
|
echo '<div style="' . $banner_style . '" id="cookie-banner">';
|
||||||
|
echo '<p>' . esc_html($banner_text) . ' <a href="' . esc_url($policy_url) . '">' . __('Mehr erfahren', 'wp-multi-toolkit') . '</a> | <a href="' . esc_url($impressum_url) . '">' . __('Impressum', 'wp-multi-toolkit') . '</a></p>';
|
||||||
|
echo '<button id="accept-cookies" class="button">' . esc_html($accept_text) . '</button>';
|
||||||
|
echo '<button id="decline-cookies" class="button">' . esc_html($decline_text) . '</button>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
// JavaScript zum Setzen des Cookies nach Zustimmung
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.getElementById('accept-cookies').addEventListener('click', function() {
|
||||||
|
document.cookie = "wpmt_cookie_accepted=true; path=/; max-age=" + (60 * 60 * 24 * 365); // 1 Jahr gültig
|
||||||
|
document.getElementById('cookie-banner').style.display = 'none';
|
||||||
|
|
||||||
|
// Speichern der Zustimmung in der Datenbank
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', '<?php echo admin_url('admin-ajax.php'); ?>', true);
|
xhr.open('POST', '<?php echo admin_url('admin-ajax.php'); ?>', true);
|
||||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
xhr.send('action=wpmt_save_cookie_consent&cookie_accepted=' + encodeURIComponent(JSON.stringify(settings)));
|
xhr.send('action=wpmt_save_cookie_consent&cookie_accepted=true');
|
||||||
}
|
});
|
||||||
|
|
||||||
|
document.getElementById('decline-cookies').addEventListener('click', function() {
|
||||||
|
document.getElementById('cookie-banner').style.display = 'none';
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
add_action('wp_footer', 'wpmt_cookie_banner');
|
add_action('wp_footer', 'wpmt_cookie_banner');
|
||||||
|
|
||||||
// AJAX-Aktion für das Speichern der Zustimmung
|
// AJAX-Aktion für das Speichern der Zustimmung
|
||||||
function anonymize_ip($ip) {
|
|
||||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
|
||||||
$parts = explode('.', $ip);
|
|
||||||
return implode('.', array_slice($parts, 0, 2)) . '.0.0';
|
|
||||||
} elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
|
||||||
return bin2hex(inet_pton($ip) & pack('H*', 'ffffffffffffffff0000000000000000'));
|
|
||||||
}
|
|
||||||
return $ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
function wpmt_save_cookie_consent() {
|
function wpmt_save_cookie_consent() {
|
||||||
if (isset($_POST['cookie_accepted']) && $_POST['cookie_accepted'] === 'true') {
|
if (isset($_POST['cookie_accepted']) && $_POST['cookie_accepted'] === 'true') {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
// Speichern der Zustimmung in der Datenbank
|
||||||
$wpdb->insert(
|
$wpdb->insert(
|
||||||
$wpdb->prefix . 'wpmt_cookie_consent',
|
$wpdb->prefix . 'wpmt_cookie_consent',
|
||||||
array(
|
array(
|
||||||
'user_ip' => anonymize_ip($_SERVER['REMOTE_ADDR']),
|
'user_ip' => $_SERVER['REMOTE_ADDR'],
|
||||||
'consent_given' => 1,
|
'consent_given' => 1,
|
||||||
'timestamp' => current_time('mysql')
|
'timestamp' => current_time('mysql')
|
||||||
)
|
)
|
||||||
@ -1023,6 +998,7 @@ add_action('admin_menu', 'add_support_ticket_page');
|
|||||||
/*
|
/*
|
||||||
* Virtueller Assistent als Submenü
|
* Virtueller Assistent als Submenü
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined('ABSPATH') or die('No direct access allowed.');
|
defined('ABSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1053,7 +1029,7 @@ function wpmt_virtual_assistant_page() {
|
|||||||
}, $keywords));
|
}, $keywords));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="wrap animate-fade-in">
|
<div class="wrap">
|
||||||
<h1><?php _e('WP Multi Virtueller Assistent', 'wp-multi-toolkit'); ?></h1>
|
<h1><?php _e('WP Multi Virtueller Assistent', 'wp-multi-toolkit'); ?></h1>
|
||||||
<div class="wpmt-assistant-container">
|
<div class="wpmt-assistant-container">
|
||||||
<div class="wpmt-assistant-header">
|
<div class="wpmt-assistant-header">
|
||||||
@ -1088,13 +1064,13 @@ function wpmt_virtual_assistant_page() {
|
|||||||
$('#assistant-chat-messages').empty();
|
$('#assistant-chat-messages').empty();
|
||||||
if (chatHistory.length === 0) {
|
if (chatHistory.length === 0) {
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message assistant animate-slide-in-left"><?php printf(__('Hi %s! Stell mir einfach eine Frage, und ich lege los! 🚀', 'wp-multi-toolkit'), esc_js($user_name)); ?></div>'
|
'<div class="wpmt-message assistant"><?php printf(__('Hi %s! Stell mir einfach eine Frage, und ich lege los! 🚀', 'wp-multi-toolkit'), esc_js($user_name)); ?></div>'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
chatHistory.forEach(function(item) {
|
chatHistory.forEach(function(item) {
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message user animate-slide-in-right">' + item.question + '</div>' +
|
'<div class="wpmt-message user">' + item.question + '</div>' +
|
||||||
'<div class="wpmt-message assistant animate-slide-in-left">' + item.response + '</div>'
|
'<div class="wpmt-message assistant">' + item.response + '</div>'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1116,8 +1092,8 @@ function wpmt_virtual_assistant_page() {
|
|||||||
|
|
||||||
// Füge die Frage und den "Tippen"-Hinweis hinzu
|
// Füge die Frage und den "Tippen"-Hinweis hinzu
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message user animate-slide-in-right">' + question + '</div>' +
|
'<div class="wpmt-message user">' + question + '</div>' +
|
||||||
'<div class="wpmt-message assistant wpmt-typing animate-slide-in-left"><?php _e('Ich tippe gerade', 'wp-multi-toolkit'); ?><span class="typing-dots">...</span></div>'
|
'<div class="wpmt-message assistant wpmt-typing"><?php _e('Ich tippe gerade...', 'wp-multi-toolkit'); ?></div>'
|
||||||
);
|
);
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
|
||||||
@ -1135,7 +1111,7 @@ function wpmt_virtual_assistant_page() {
|
|||||||
$('.wpmt-typing').remove();
|
$('.wpmt-typing').remove();
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message assistant animate-slide-in-left">' + response.data.response + '</div>'
|
'<div class="wpmt-message assistant">' + response.data.response + '</div>'
|
||||||
);
|
);
|
||||||
chatHistory.push({
|
chatHistory.push({
|
||||||
question: question,
|
question: question,
|
||||||
@ -1146,7 +1122,7 @@ function wpmt_virtual_assistant_page() {
|
|||||||
lastQuestion = question;
|
lastQuestion = question;
|
||||||
} else {
|
} else {
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message assistant animate-slide-in-left"><?php _e('Ups, etwas ist schiefgelaufen. Versuche es nochmal! 😓', 'wp-multi-toolkit'); ?></div>'
|
'<div class="wpmt-message assistant"><?php _e('Ups, etwas ist schiefgelaufen. Versuche es nochmal! 😓', 'wp-multi-toolkit'); ?></div>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
@ -1154,7 +1130,7 @@ function wpmt_virtual_assistant_page() {
|
|||||||
error: function() {
|
error: function() {
|
||||||
$('.wpmt-typing').remove();
|
$('.wpmt-typing').remove();
|
||||||
$('#assistant-chat-messages').append(
|
$('#assistant-chat-messages').append(
|
||||||
'<div class="wpmt-message assistant animate-slide-in-left"><?php _e('Oh nein, meine Verbindung ist abgebrochen! 😵 Überprüfe deine Internetverbindung und versuche es erneut.', 'wp-multi-toolkit'); ?></div>'
|
'<div class="wpmt-message assistant"><?php _e('Oh nein, meine Verbindung ist abgebrochen! 😵 Überprüfe deine Internetverbindung und versuche es erneut.', 'wp-multi-toolkit'); ?></div>'
|
||||||
);
|
);
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
@ -1266,7 +1242,6 @@ function wpmt_virtual_assistant_page() {
|
|||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
opacity: 0; /* Für Animation */
|
|
||||||
}
|
}
|
||||||
.wpmt-message.user {
|
.wpmt-message.user {
|
||||||
background: #0073aa;
|
background: #0073aa;
|
||||||
@ -1354,42 +1329,6 @@ function wpmt_virtual_assistant_page() {
|
|||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animationen */
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from { opacity: 0; }
|
|
||||||
to { opacity: 1; }
|
|
||||||
}
|
|
||||||
@keyframes slideInLeft {
|
|
||||||
from { transform: translateX(-20px); opacity: 0; }
|
|
||||||
to { transform: translateX(0); opacity: 1; }
|
|
||||||
}
|
|
||||||
@keyframes slideInRight {
|
|
||||||
from { transform: translateX(20px); opacity: 0; }
|
|
||||||
to { transform: translateX(0); opacity: 1; }
|
|
||||||
}
|
|
||||||
@keyframes typingDots {
|
|
||||||
0% { content: '.'; }
|
|
||||||
33% { content: '..'; }
|
|
||||||
66% { content: '...'; }
|
|
||||||
100% { content: '.'; }
|
|
||||||
}
|
|
||||||
.animate-fade-in {
|
|
||||||
animation: fadeIn 0.5s ease forwards;
|
|
||||||
}
|
|
||||||
.animate-slide-in-left {
|
|
||||||
animation: slideInLeft 0.5s ease forwards;
|
|
||||||
}
|
|
||||||
.animate-slide-in-right {
|
|
||||||
animation: slideInRight 0.5s ease forwards;
|
|
||||||
}
|
|
||||||
.wpmt-typing .typing-dots::after {
|
|
||||||
content: '...';
|
|
||||||
display: inline-block;
|
|
||||||
width: 1.5em;
|
|
||||||
text-align: left;
|
|
||||||
animation: typingDots 1.5s infinite;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@ -1640,10 +1579,10 @@ function wpmt_add_assistant_page() {
|
|||||||
}
|
}
|
||||||
add_action('admin_menu', 'wpmt_add_assistant_page');
|
add_action('admin_menu', 'wpmt_add_assistant_page');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Antworten vordefinieren
|
* Antworten vordefinieren
|
||||||
*/
|
*/
|
||||||
add_filter('wpmt_assistant_responses', function($responses) {
|
add_filter('wpmt_assistant_responses', function($responses) {
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
$user_name = $current_user->display_name ?: __('Freund', 'wp-multi-toolkit');
|
$user_name = $current_user->display_name ?: __('Freund', 'wp-multi-toolkit');
|
||||||
|
|
||||||
@ -1918,15 +1857,15 @@ add_action('admin_menu', 'wpmt_add_assistant_page');
|
|||||||
);
|
);
|
||||||
|
|
||||||
return $responses;
|
return $responses;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sicherstellen, dass jQuery geladen wird
|
* Sicherstellen, dass jQuery geladen wird
|
||||||
*/
|
*/
|
||||||
function wpmt_enqueue_scripts() {
|
function wpmt_enqueue_scripts() {
|
||||||
wp_enqueue_script('jquery');
|
wp_enqueue_script('jquery');
|
||||||
}
|
}
|
||||||
add_action('admin_enqueue_scripts', 'wpmt_enqueue_scripts');
|
add_action('admin_enqueue_scripts', 'wpmt_enqueue_scripts');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1963,11 +1902,11 @@ add_action('admin_menu', 'wpmt_add_assistant_page');
|
|||||||
add_action('admin_footer', 'wpmt_add_floating_toolbar');
|
add_action('admin_footer', 'wpmt_add_floating_toolbar');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update Funktion
|
* Update Funktion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
define('WPMT_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
define('WPMT_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||||
|
|
||||||
// Textdomain laden
|
// Textdomain laden
|
||||||
@ -2359,11 +2298,6 @@ function wpmt_update_dashboard_widget_content() {
|
|||||||
'file' => 'wp-multi-kategorie/wp-multi-kategorie.php',
|
'file' => 'wp-multi-kategorie/wp-multi-kategorie.php',
|
||||||
'name' => 'WP Multi Kategorie',
|
'name' => 'WP Multi Kategorie',
|
||||||
'repo' => 'wp-multi-kategorie'
|
'repo' => 'wp-multi-kategorie'
|
||||||
),
|
|
||||||
'wp-multi-teamcard' => array(
|
|
||||||
'file' => 'wp-multi-teamcards/wp-multi-team-card.php',
|
|
||||||
'name' => 'WP Multi Team-Card',
|
|
||||||
'repo' => 'wp-multi-teamcard'
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2580,22 +2514,24 @@ function wp_multi_toolkit_setup_menu() {
|
|||||||
### Function: Get IP Address
|
### Function: Get IP Address
|
||||||
function wp_multi_ban_get_ip() {
|
function wp_multi_ban_get_ip() {
|
||||||
$banned_options = get_option('wp_multi_ban_options', array('reverse_proxy' => 0));
|
$banned_options = get_option('wp_multi_ban_options', array('reverse_proxy' => 0));
|
||||||
$ip = '';
|
|
||||||
|
|
||||||
if (!empty($banned_options['reverse_proxy']) && intval($banned_options['reverse_proxy']) === 1) {
|
if (!empty($banned_options['reverse_proxy']) && intval($banned_options['reverse_proxy']) === 1) {
|
||||||
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
|
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
|
||||||
if (!empty($_SERVER[$key])) {
|
if (!empty($_SERVER[$key])) {
|
||||||
foreach (explode(',', $_SERVER[$key]) as $potential_ip) {
|
foreach (explode(',', $_SERVER[$key]) as $ip) {
|
||||||
$potential_ip = trim($potential_ip);
|
$ip = trim($ip);
|
||||||
if (filter_var($potential_ip, FILTER_VALIDATE_IP)) {
|
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||||
return $potential_ip;
|
return esc_attr($ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) {
|
} elseif (!empty($_SERVER['REMOTE_ADDR'])) {
|
||||||
$ip = explode(',', $_SERVER['REMOTE_ADDR'])[0];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
return $ip;
|
if (strpos($ip, ',') !== false) {
|
||||||
|
$ip = explode(',', $ip)[0];
|
||||||
|
}
|
||||||
|
return esc_attr($ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user