Created
November 19, 2024 12:43
-
-
Save kharissulistiyo/1da55791646b7287fb72e6ee9ba1ebd0 to your computer and use it in GitHub Desktop.
Patch code sample: Cross Site Request Forgery (CSRF) vulnerability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public static function render_settings_page() { | |
if ( isset( $_POST['save_settings'] ) ) { | |
self::save_settings( $_POST ); | |
} | |
if ( ! isset( $_POST['cew_settings_nonce'] ) || ! wp_verify_nonce( $_POST['cew_settings_nonce'], CEW_BASENAME . '-settings' ) ) { | |
return; | |
} | |
wp_enqueue_style( 'cew-settings', CEW_URL . 'assets/css/settings.css', array(), CEW_VERSION ); | |
wp_enqueue_script( 'cew-settings', CEW_URL . 'assets/js/scripts.js', array( 'jquery', 'jquery-ui' ), CEW_VERSION, true ); | |
wp_localize_script( | |
'cew-settings', | |
'cew', | |
array( | |
'ajax_url' => admin_url( 'admin-ajax.php' ), | |
) | |
); | |
include_once CEW_PATH . '/templates/settings.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment