| Server IP : 145.239.37.162 / Your IP : 216.73.217.81 Web Server : Apache System : Linux webm003.cluster130.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaa ( 38250) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaa/www2024/wp-content/plugins/pop-up-aeb/admin/ |
Upload File : |
<?php
class Pop_up_admin
{
public static function display()
{
include plugin_dir_path(__FILE__) . 'pop-up-view-admin.php';
}
public static function save_form()
{
// check form completed
if (!isset($_POST['pop_up_nonce']) || !wp_verify_nonce($_POST['pop_up_nonce'], 'pop_up_save')) {
return;
}
// save image id
if (isset($_POST['meta-box-image'])) {
update_option('meta-box-image', intval($_POST['meta-box-image']));
}
// && $_POST['meta-box-video']['error'] === 0)
if (isset($_POST['meta-box-video'])) {
update_option('meta-box-video', intval($_POST['meta-box-video']));
// Traitement de la vidéo...
// Enregistrement, validation, etc.
}
if (isset($_POST['meta-box-poster'])) {
update_option('meta-box-poster', intval($_POST['meta-box-poster']));
}
// save datas, define which fields
$fields = [
'set_active',
'title',
'link',
'text',
'type',
'width',
'height',
'type',
'position_type',
'position_y_side',
'position_y_val',
'position_x_side',
'position_x_val',
'animation_type',
'animation_duration',
'size'
];
$excluded_pages = [
'404-2',
'contact',
'mentions-legales',
'partenaires',
'politique-de-confidentialite'
];
$pages = get_pages();
$selected_pages = [];
foreach ($pages as $page) {
if (!in_array($page->post_name, $excluded_pages)) :
$fields[] = $page->post_name;
endif;
}
foreach ($fields as $field) {
if (in_array($field, $selected_pages)) { //vérifie que le champ correspond a une page
update_option($field, $_POST[$field]);
} elseif ($field === 'text') {
update_option($field, wp_unslash(wp_kses_post($_POST[$field])));
} else {
update_option($field, nl2br(sanitize_text_field($_POST[$field])));
}
}
// Ajoutez votre message de réussite ici
$query = array(
'updated' => true,
'message' => urlencode('Vos modifications ont été enregistrées avec succès.'),
);
// Redirige vers la même page pour éviter les soumissions multiples
$redirect_url = add_query_arg($query, wp_get_referer());
wp_redirect($redirect_url);
exit;
}
}
add_action('admin_init', array('Pop_up_admin', 'save_form'));
add_action('admin_post_pop_up_save_form', array('Pop_up_admin', 'save_form'));
add_action('admin_post_nopriv_pop_up_save_form', array('Pop_up_admin', 'save_form'));