Security check failed.

'); } ?>
Are you sure you want to do this?

'); } // First check if ID exist with requested ID $sSql = $wpdb->prepare( "SELECT COUNT(*) AS `count` FROM ".AnythingPopupTable." WHERE `pop_id` = %d", array($did) ); $result = '0'; $result = $wpdb->get_var($sSql); if ($result != '1') { ?>

prepare(" SELECT * FROM `".AnythingPopupTable."` WHERE `pop_id` = %d LIMIT 1 ", array($did) ); $data = array(); $data = $wpdb->get_row($sSql, ARRAY_A); // Preset the form fields $form = array( 'pop_width' => $data['pop_width'], 'pop_height' => $data['pop_height'], 'pop_headercolor' => $data['pop_headercolor'], 'pop_bordercolor' => $data['pop_bordercolor'], 'pop_header_fontcolor' => $data['pop_header_fontcolor'], 'pop_title' => $data['pop_title'], 'pop_content' => $data['pop_content'], 'pop_caption' => $data['pop_caption'], 'pop_id' => $data['pop_id'] ); } // Form submitted, check the data if (isset($_POST['pop_form_submit']) && $_POST['pop_form_submit'] == 'yes') { // Just security thingy that wordpress offers us check_admin_referer('pop_form_edit'); $form['pop_width'] = isset($_POST['pop_width']) ? sanitize_text_field($_POST['pop_width']) : ''; if ($form['pop_width'] == '') { $pop_errors[] = __('Please enter the popup window width, only number.', 'anything-popup'); $pop_error_found = TRUE; } if(!is_numeric($form['pop_width'])) { $form['pop_width'] = 300; } $form['pop_height'] = isset($_POST['pop_height']) ? sanitize_text_field($_POST['pop_height']) : ''; if ($form['pop_height'] == '') { $pop_errors[] = __('Please enter the popup window height, only number.', 'anything-popup'); $pop_error_found = TRUE; } if(!is_numeric($form['pop_height'])) { $form['pop_height'] = 250; } $form['pop_headercolor'] = isset($_POST['pop_headercolor']) ? sanitize_text_field($_POST['pop_headercolor']) : ''; if ($form['pop_headercolor'] == '') { $pop_errors[] = __('Please enter the header color.', 'anything-popup'); $pop_error_found = TRUE; } if(!preg_match('/^#[a-f0-9]{6}$/i',$form['pop_headercolor'])) { $pop_errors[] = __('Please enter valid header color.', 'anything-popup'); $pop_error_found = TRUE; } $form['pop_bordercolor'] = isset($_POST['pop_bordercolor']) ? sanitize_text_field($_POST['pop_bordercolor']) : ''; if ($form['pop_bordercolor'] == '') { $pop_errors[] = __('Please enter the border color.', 'anything-popup'); $pop_error_found = TRUE; } if(!preg_match('/^#[a-f0-9]{6}$/i',$form['pop_bordercolor'])) { $pop_errors[] = __('Please enter valid border color.', 'anything-popup'); $pop_error_found = TRUE; } $form['pop_header_fontcolor'] = isset($_POST['pop_header_fontcolor']) ? sanitize_text_field($_POST['pop_header_fontcolor']) : ''; if ($form['pop_header_fontcolor'] == '') { $pop_errors[] = __('Please enter the heder font color.', 'anything-popup'); $pop_error_found = TRUE; } if(!preg_match('/^#[a-f0-9]{6}$/i',$form['pop_header_fontcolor'])) { $pop_errors[] = __('Please enter valid heder font color.', 'anything-popup'); $pop_error_found = TRUE; } $form['pop_title'] = isset($_POST['pop_title']) ? sanitize_text_field($_POST['pop_title']) : ''; if ($form['pop_title'] == '') { $pop_errors[] = __('Please enter the popup title.', 'anything-popup'); $pop_error_found = TRUE; } $form['pop_content'] = isset($_POST['pop_content']) ? wp_filter_post_kses($_POST['pop_content']) : ''; if ($form['pop_content'] == '') { $pop_errors[] = __('Please enter the popup link text/image.', 'anything-popup'); $pop_error_found = TRUE; } $form['pop_caption'] = isset($_POST['pop_caption']) ? wp_filter_post_kses($_POST['pop_caption']) : ''; if ($form['pop_caption'] == '') { $pop_errors[] = __('Please enter the popup content.', 'anything-popup'); $pop_error_found = TRUE; } // No errors found, we can add this Group to the table if ($pop_error_found == FALSE) { $sSql = $wpdb->prepare( "UPDATE `".AnythingPopupTable."` SET `pop_width` = %s, `pop_height` = %s, `pop_headercolor` = %s, `pop_bordercolor` = %s, `pop_header_fontcolor` = %s, `pop_title` = %s, `pop_content` = %s, `pop_caption` = %s WHERE pop_id = %d LIMIT 1", array($form['pop_width'], $form['pop_height'], $form['pop_headercolor'], $form['pop_bordercolor'], $form['pop_header_fontcolor'], $form['pop_title'], $form['pop_content'], $form['pop_caption'], $did) ); $wpdb->query($sSql); $pop_success = __('Details was successfully updated.', 'anything-popup'); } } if ($pop_error_found == TRUE && isset($pop_errors[0]) == TRUE) { ?>

0) { ?>


(Ex: 300)

(Ex: 250)

(Ex: #4D4D4D)

(Ex: #4D4D4D)

(Ex: #FFFFFF)