wp-multi-toolkit.php aktualisiert
This commit is contained in:
parent
1003f7f0ec
commit
d02bba1447
@ -3,7 +3,7 @@
|
|||||||
* 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.2
|
* Version: 1.0.3
|
||||||
* 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
|
||||||
@ -18,14 +18,84 @@
|
|||||||
|
|
||||||
defined('ABSPATH') or die('No direct access allowed.');
|
defined('ABSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
|
// Funktion, um zukünftige Posts zu veröffentlichen
|
||||||
|
function pubMissedPosts() {
|
||||||
|
if (is_front_page() || is_single()) {
|
||||||
|
|
||||||
|
global $wpdb;
|
||||||
|
$now = gmdate('Y-m-d H:i:00');
|
||||||
|
|
||||||
|
// Überprüfe, ob benutzerdefinierte Beitragstypen vorhanden sind
|
||||||
|
$args = array(
|
||||||
|
'public' => true,
|
||||||
|
'_builtin' => false,
|
||||||
|
);
|
||||||
|
|
||||||
|
$output = 'names'; // names oder objects, names ist der Standard
|
||||||
|
$operator = 'and'; // 'and' oder 'or'
|
||||||
|
$post_types = get_post_types($args, $output, $operator);
|
||||||
|
|
||||||
|
if (count($post_types) === 0) {
|
||||||
|
$sql = "SELECT ID FROM $wpdb->posts WHERE post_type IN ('post', 'page') AND post_status = 'future' AND post_date_gmt < '$now'";
|
||||||
|
} else {
|
||||||
|
$str = implode('\',\'', $post_types);
|
||||||
|
$sql = "SELECT ID FROM $wpdb->posts WHERE post_type IN ('page', 'post', '$str') AND post_status = 'future' AND post_date_gmt < '$now'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$resulto = $wpdb->get_results($sql);
|
||||||
|
if ($resulto) {
|
||||||
|
foreach ($resulto as $thisarr) {
|
||||||
|
wp_publish_post($thisarr->ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Die Funktion beim Laden der Seite aufrufen
|
||||||
|
add_action('wp_head', 'pubMissedPosts');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Abhängigkeitsprüfung: WP Multi Kategorie
|
||||||
|
*/
|
||||||
|
function wp_multi_toolkit_check_kategorie_dependency() {
|
||||||
|
if (!function_exists('is_plugin_active')) {
|
||||||
|
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prüfen, ob WP Multi Kategorie installiert und aktiv ist
|
||||||
|
if (!is_plugin_active('wp-multi-kategorie/wp-multi-kategorie.php')) {
|
||||||
|
add_action('admin_notices', 'wp_multi_toolkit_kategorie_dependency_notice');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin-Hinweis, falls Abhängigkeit fehlt
|
||||||
|
function wp_multi_toolkit_kategorie_dependency_notice() {
|
||||||
|
?>
|
||||||
|
<div class="notice notice-warning">
|
||||||
|
<p>
|
||||||
|
<?php _e('Das Plugin "WP Multi Toolkit" empfiehlt die Installation von "WP Multi Kategorie", um alle Funktionen nutzen zu können.', 'wp-multi-toolkit'); ?>
|
||||||
|
<a href="https://git.viper.ipv64.net/M_Viper/WP-Multi-Kategorie/releases" target="_blank" class="button button-primary" style="margin-left: 10px;">
|
||||||
|
<?php _e('WP Multi Kategorie herunterladen', 'wp-multi-toolkit'); ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_multi_toolkit_check_kategorie_dependency();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gitea - Ticket - BUG - Report
|
* Gitea - Ticket - BUG - Report
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Funktion zur Erstellung eines Support-Tickets
|
|
||||||
function send_support_ticket_to_server($plugin_name, $title, $description, $label = 'bug') {
|
function send_support_ticket_to_server($plugin_name, $title, $description, $label = 'bug') {
|
||||||
$server_url = 'https://m-viper.de/gitea-issue-creator.php';
|
$server_url = 'https://m-viper.de/gitea-issue-creator.php';
|
||||||
|
|
||||||
|
// Hier wird das Plugin korrekt übergeben
|
||||||
$data = [
|
$data = [
|
||||||
'plugin' => $plugin_name,
|
'plugin' => $plugin_name,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
@ -59,7 +129,7 @@ function send_support_ticket_to_server($plugin_name, $title, $description, $labe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formular für das Support-Ticket mit Design
|
// Support-Ticket Formular
|
||||||
function support_ticket_form() {
|
function support_ticket_form() {
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
@ -73,6 +143,7 @@ function support_ticket_form() {
|
|||||||
<option value="wp-multi-search">WP Multi Search</option>
|
<option value="wp-multi-search">WP Multi Search</option>
|
||||||
<option value="wp-multi-toolkit">WP Multi Toolkit</option>
|
<option value="wp-multi-toolkit">WP Multi Toolkit</option>
|
||||||
<option value="wp-multi-comment-notifications">WP Multi Comment Notifications</option>
|
<option value="wp-multi-comment-notifications">WP Multi Comment Notifications</option>
|
||||||
|
<option value="wp-multi-kategorie">WP Multi Kategorie</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -108,6 +179,7 @@ function support_ticket_form() {
|
|||||||
$title = sanitize_text_field($_POST['ticket_title']);
|
$title = sanitize_text_field($_POST['ticket_title']);
|
||||||
$description = sanitize_textarea_field($_POST['ticket_description']);
|
$description = sanitize_textarea_field($_POST['ticket_description']);
|
||||||
$label = sanitize_text_field($_POST['ticket_label']);
|
$label = sanitize_text_field($_POST['ticket_label']);
|
||||||
|
// Übergebe die richtigen Werte an die Ticket-Erstellung
|
||||||
$result = send_support_ticket_to_server($plugin_name, $title, $description, $label);
|
$result = send_support_ticket_to_server($plugin_name, $title, $description, $label);
|
||||||
echo '<div class="response-message">' . $result . '</div>';
|
echo '<div class="response-message">' . $result . '</div>';
|
||||||
}
|
}
|
||||||
@ -116,7 +188,6 @@ function support_ticket_form() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// CSS nur auf der Ticket-Seite (wp_multi_support) ausgeben
|
|
||||||
if (isset($_GET['page']) && $_GET['page'] === 'wp_multi_support') {
|
if (isset($_GET['page']) && $_GET['page'] === 'wp_multi_support') {
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
@ -198,23 +269,22 @@ function support_ticket_form() {
|
|||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menüseite hinzufügen
|
// Menüseite hinzufügen
|
||||||
function add_support_ticket_page() {
|
function add_support_ticket_page() {
|
||||||
add_menu_page(
|
add_menu_page(
|
||||||
'WP-Multi Support', // Seitentitel
|
'WP-Multi Support',
|
||||||
'WP-Multi Support', // Menüname
|
'WP-Multi Support',
|
||||||
'manage_options', // Berechtigung
|
'manage_options',
|
||||||
'wp_multi_support', // Slug (angepasst für Konsistenz)
|
'wp_multi_support',
|
||||||
'support_ticket_form' // Funktion, die das Formular rendert
|
'support_ticket_form'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('admin_menu', 'add_support_ticket_page');
|
add_action('admin_menu', 'add_support_ticket_page');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// ### Update Funktion ###
|
// ### Update Funktion ###
|
||||||
*/
|
*/
|
||||||
@ -275,6 +345,110 @@ function wpmt_multi_shortcode($atts) {
|
|||||||
}
|
}
|
||||||
add_shortcode('wpmt_multi', 'wpmt_multi_shortcode');
|
add_shortcode('wpmt_multi', 'wpmt_multi_shortcode');
|
||||||
|
|
||||||
|
// ### Automatisierte Plugin-Dokumentation ###
|
||||||
|
|
||||||
|
// Funktion zur Generierung der Dokumentation
|
||||||
|
function wpmt_generate_plugin_docs() {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
|
||||||
|
$installed_plugins = get_plugins();
|
||||||
|
$wp_multi_plugins = array(
|
||||||
|
'wp-multi-toolkit' => array(
|
||||||
|
'file' => 'wp-multi-toolkit/wp-multi-toolkit.php',
|
||||||
|
'name' => 'WP Multi Toolkit',
|
||||||
|
'description' => __('Zentrales Toolkit für die WP Multi Plugin-Reihe mit Update-Management und Support-Funktionen.', 'wp-multi-toolkit'),
|
||||||
|
'repo' => 'wp-multi-toolkit'
|
||||||
|
),
|
||||||
|
'wp-multi' => array(
|
||||||
|
'file' => 'WP-Multi/wp-multi.php',
|
||||||
|
'name' => 'WP Multi',
|
||||||
|
'description' => __('Hauptplugin für Multi-Funktionen mit Shortcode-Unterstützung.', 'wp-multi-toolkit'),
|
||||||
|
'repo' => 'wp-multi'
|
||||||
|
),
|
||||||
|
'wp-multi-search' => array(
|
||||||
|
'file' => 'wp-multi-search/wp-multi-search.php',
|
||||||
|
'name' => 'WP Multi Search',
|
||||||
|
'description' => __('Erweiterte Suchfunktionen für WordPress.', 'wp-multi-toolkit'),
|
||||||
|
'repo' => 'WP-Multi-Search'
|
||||||
|
),
|
||||||
|
'wp-multi-comment-notifications' => array(
|
||||||
|
'file' => 'wp-multi-comment-notifications/wp-multi-comment-notifications.php',
|
||||||
|
'name' => 'WP Multi Comment Notifications',
|
||||||
|
'description' => __('Automatische Benachrichtigungen für neue Kommentare.', 'wp-multi-toolkit'),
|
||||||
|
'repo' => 'wp-multi-comment-notifications'
|
||||||
|
),
|
||||||
|
'wp-multi-kategorie' => array(
|
||||||
|
'file' => 'wp-multi-kategorie/wp-multi-kategorie.php',
|
||||||
|
'name' => 'WP Multi Kategorie',
|
||||||
|
'repo' => 'wp-multi-kategorie'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="wrap">
|
||||||
|
<h1><?php echo esc_html__('WP Multi Plugin-Dokumentation', 'wp-multi-toolkit'); ?></h1>
|
||||||
|
<p><?php echo esc_html__('Hier finden Sie eine Übersicht aller WP Multi Plugins, einschließlich Versionen und grundlegender Informationen.', 'wp-multi-toolkit'); ?></p>
|
||||||
|
|
||||||
|
<?php foreach ($wp_multi_plugins as $key => $plugin) : ?>
|
||||||
|
<div class="wpmt-docs-section">
|
||||||
|
<h2><?php echo esc_html($plugin['name']); ?></h2>
|
||||||
|
<?php
|
||||||
|
$is_installed = array_key_exists($plugin['file'], $installed_plugins);
|
||||||
|
if ($is_installed) {
|
||||||
|
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin['file']);
|
||||||
|
$is_active = is_plugin_active($plugin['file']);
|
||||||
|
?>
|
||||||
|
<p><strong><?php echo esc_html__('Status', 'wp-multi-toolkit'); ?>:</strong> <?php echo $is_active ? esc_html__('Aktiv', 'wp-multi-toolkit') : esc_html__('Inaktiv', 'wp-multi-toolkit'); ?></p>
|
||||||
|
<p><strong><?php echo esc_html__('Version', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html($plugin_data['Version']); ?></p>
|
||||||
|
<p><strong><?php echo esc_html__('Beschreibung', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html($plugin_data['Description']); ?></p>
|
||||||
|
<p><strong><?php echo esc_html__('Plugin-URI', 'wp-multi-toolkit'); ?>:</strong> <a href="<?php echo esc_url($plugin_data['PluginURI']); ?>" target="_blank"><?php echo esc_url($plugin_data['PluginURI']); ?></a></p>
|
||||||
|
<?php if (!empty($plugin_data['RequiresWP'])) : ?>
|
||||||
|
<p><strong><?php echo esc_html__('Benötigt WordPress', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html($plugin_data['RequiresWP']); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($plugin_data['TestedWP'])) : ?>
|
||||||
|
<p><strong><?php echo esc_html__('Getestet bis WordPress', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html($plugin_data['TestedWP']); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<p><strong><?php echo esc_html__('Status', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html__('Nicht installiert', 'wp-multi-toolkit'); ?></p>
|
||||||
|
<p><strong><?php echo esc_html__('Beschreibung', 'wp-multi-toolkit'); ?>:</strong> <?php echo esc_html($plugin['description']); ?></p>
|
||||||
|
<p><strong><?php echo esc_html__('Download', 'wp-multi-toolkit'); ?>:</strong> <a href="https://git.viper.ipv64.net/M_Viper/<?php echo esc_attr($plugin['repo']); ?>/releases" target="_blank"><?php echo esc_html__('Download-Seite', 'wp-multi-toolkit'); ?></a></p>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.wpmt-docs-section {
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
.wpmt-docs-section h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
color: #23282d;
|
||||||
|
}
|
||||||
|
.wpmt-docs-section p {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// Menüseite für Dokumentation hinzufügen
|
||||||
|
function wpmt_add_docs_page() {
|
||||||
|
add_submenu_page(
|
||||||
|
'wp_multi_support', // Eltern-Slug
|
||||||
|
__('WP Multi Dokumentation', 'wp-multi-toolkit'), // Seitentitel
|
||||||
|
__('Dokumentation', 'wp-multi-toolkit'), // Menüname
|
||||||
|
'manage_options', // Berechtigung
|
||||||
|
'wpmt_docs', // Slug
|
||||||
|
'wpmt_generate_plugin_docs' // Funktion
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action('admin_menu', 'wpmt_add_docs_page');
|
||||||
|
|
||||||
// ### Update-Management ###
|
// ### Update-Management ###
|
||||||
|
|
||||||
// Widget zum Admin-Dashboard hinzufügen
|
// Widget zum Admin-Dashboard hinzufügen
|
||||||
@ -434,6 +608,11 @@ function wpmt_update_dashboard_widget_content() {
|
|||||||
'file' => 'wp-multi-comment-notifications/wp-multi-comment-notifications.php',
|
'file' => 'wp-multi-comment-notifications/wp-multi-comment-notifications.php',
|
||||||
'name' => 'WP Multi Comment Notifications',
|
'name' => 'WP Multi Comment Notifications',
|
||||||
'repo' => 'wp-multi-comment-notifications'
|
'repo' => 'wp-multi-comment-notifications'
|
||||||
|
),
|
||||||
|
'wp-multi-kategorie' => array(
|
||||||
|
'file' => 'wp-multi-kategorie/wp-multi-kategorie.php',
|
||||||
|
'name' => 'WP Multi Kategorie',
|
||||||
|
'repo' => 'wp-multi-kategorie'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -535,6 +714,11 @@ function wpmt_update_dashboard_widget_content() {
|
|||||||
'file' => 'wp-multi-comment-notifications/wp-multi-comment-notifications.php',
|
'file' => 'wp-multi-comment-notifications/wp-multi-comment-notifications.php',
|
||||||
'download_url' => 'https://git.viper.ipv64.net/M_Viper/wp-multi-comment-notifications/releases',
|
'download_url' => 'https://git.viper.ipv64.net/M_Viper/wp-multi-comment-notifications/releases',
|
||||||
'description' => __('Kommentar-Benachrichtigungen.', 'wp-multi-toolkit')
|
'description' => __('Kommentar-Benachrichtigungen.', 'wp-multi-toolkit')
|
||||||
|
),
|
||||||
|
'wp-multi-kategorie' => array(
|
||||||
|
'file' => 'wp-multi-kategorie/wp-multi-kategorie.php',
|
||||||
|
'download_url' => 'https://git.viper.ipv64.net/M_Viper/wp-multi-kategorie/releases',
|
||||||
|
'description' => __('Erweiterte Kategorie-Funktionen für WP Multi.', 'wp-multi-toolkit')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user