admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'aiodify_admin_nonce' ), 'strings' => array( 'saved' => __( 'Settings saved successfully!', 'aiodify-content-protection' ), 'resetDone' => __( 'Defaults restored successfully!', 'aiodify-content-protection' ), 'resetPrompt' => __( 'Are you sure you want to reset all settings to their default values?', 'aiodify-content-protection' ), 'error' => __( 'An error occurred. Please try again.', 'aiodify-content-protection' ), ), ) ); } /** * Sanitize settings fields. * * @param array $input Raw form data. * @return array Sanitized options. */ public function sanitize_settings( $input ) { $clean = array(); $defaults = Aiodify_Content_Protection::get_default_options(); $boolean_keys = array( 'enable_protection', 'disable_right_click', 'disable_text_selection', 'disable_copy_cut_paste', 'disable_drag_drop', 'disable_image_drag', 'disable_ctrl_a', 'disable_ctrl_c', 'disable_ctrl_x', 'disable_ctrl_v', 'disable_ctrl_s', 'disable_ctrl_p', 'disable_ctrl_u', 'disable_ctrl_f', 'disable_devtools_f12', 'disable_print_screen', 'exclude_admin', 'exclude_logged_in', 'enable_warning_toast', 'toast_sound', ); foreach ( $boolean_keys as $key ) { $clean[ $key ] = ! empty( $input[ $key ] ) ? 1 : 0; } // Text & Select fields $clean['warning_message'] = ! empty( $input['warning_message'] ) ? sanitize_text_field( wp_unslash( $input['warning_message'] ) ) : $defaults['warning_message']; $valid_themes = array( 'dark_glass', 'neon_indigo', 'clean_light', 'amber_alert' ); $clean['toast_theme'] = ( isset( $input['toast_theme'] ) && in_array( $input['toast_theme'], $valid_themes, true ) ) ? sanitize_key( $input['toast_theme'] ) : 'dark_glass'; $valid_positions = array( 'top_center', 'top_right', 'bottom_center', 'bottom_right' ); $clean['toast_position'] = ( isset( $input['toast_position'] ) && in_array( $input['toast_position'], $valid_positions, true ) ) ? sanitize_key( $input['toast_position'] ) : 'top_center'; $clean['toast_duration'] = isset( $input['toast_duration'] ) ? absint( $input['toast_duration'] ) : 3000; if ( $clean['toast_duration'] < 1000 ) { $clean['toast_duration'] = 1000; } if ( $clean['toast_duration'] > 10000 ) { $clean['toast_duration'] = 10000; } return $clean; } /** * AJAX Save Settings Handler. */ public function ajax_save_settings() { check_ajax_referer( 'aiodify_admin_nonce', 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => __( 'Unauthorized access.', 'aiodify-content-protection' ) ) ); } $posted_data = isset( $_POST['settings'] ) ? (array) wp_unslash( $_POST['settings'] ) : array(); $sanitized = $this->sanitize_settings( $posted_data ); update_option( self::OPTION_KEY, $sanitized ); wp_send_json_success( array( 'message' => __( 'Settings updated successfully!', 'aiodify-content-protection' ), 'settings' => $sanitized, ) ); } /** * AJAX Reset to Default Settings Handler. */ public function ajax_reset_settings() { check_ajax_referer( 'aiodify_admin_nonce', 'nonce' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => __( 'Unauthorized access.', 'aiodify-content-protection' ) ) ); } $defaults = Aiodify_Content_Protection::get_default_options(); update_option( self::OPTION_KEY, $defaults ); wp_send_json_success( array( 'message' => __( 'Settings reset to defaults successfully!', 'aiodify-content-protection' ), 'settings' => $defaults, ) ); } /** * Render the admin settings view. */ public function render_admin_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $options = wp_parse_args( get_option( self::OPTION_KEY, array() ), Aiodify_Content_Protection::get_default_options() ); ?>

Aiodify Content Guard v

AIodify

Ctrl+A / ⌘+A
Ctrl+C / ⌘+C
Ctrl+X / ⌘+X
Ctrl+V / ⌘+V
Ctrl+S / ⌘+S
Ctrl+P / ⌘+P
Ctrl+U / ⌘+U
Ctrl+F / ⌘+F

AIodify
(Production Ready)
GPLv2 or later