wip patches added to options

This commit is contained in:
asus
2024-03-24 12:37:38 +01:00
parent 5c93938b53
commit 94dbe05f87
3 changed files with 87 additions and 19 deletions

View File

@@ -16,8 +16,9 @@ if (!defined('ABSPATH')) {
*
*/
function plugin_content() {
// Fbpatch::get_patchs();
$patches = Fbpatch::get_patchs();
$nonce = Fbpatch::NONCE;
$admin_post_patches = Fbpatch::ADMIN_POST_PATCH_CHOICE;
ob_start();
include(plugin_dir_path(__DIR__) . '/html/menu.html');
$html = ob_get_clean();
@@ -28,25 +29,31 @@ function plugin_content() {
function choose_patches() {
function patches_choice() {
$nonce = Fbpatch::NONCE;
if (!isset($_POST[$nonce['_name']])) {
\FBPATCH\redirect_menu($_POST);
return;
\FBPATCH\redirect_menu_referer($_POST);
exit;
}
if (!wp_verify_nonce($_POST[$nonce['_name']], $nonce['_action'])) {
\FBPATCH\redirect_menu($_POST);
return;
\FBPATCH\redirect_menu_referer($_POST);
exit;
}
error_log("is logged in: " . json_encode(is_user_logged_in()));
\FBPATCH\redirect_menu($_POST);
/*
*
*
*/
\FBPATCH\redirect_menu_referer($_POST);
}
add_action('admin_post_add_patches', __NAMESPACE__.'\choose_patches');
add_action('admin_post_'.Fbpatch::ADMIN_POST_PATCH_CHOICE, __NAMESPACE__.'\patches_choice');
function redirect_menu($post) {
function redirect_menu_referer($post) {
if (!isset($post)) {
wp_redirect(admin_url(), 301);
exit;