{$escaped_text}"; // Output the JavaScript code to the head. echo $custom_js; } add_action( 'wp_enqueue_scripts', 'acconsentobot_enqueue_script' ); /** * Add AcconsentoBot admin page. */ function acconsentobot_admin_menu() { add_management_page( 'AcconsentoBot', 'AcconsentoBot', 'manage_options', 'acconsentobot', 'acconsentobot_footer_text_admin_page' ); } add_action( 'admin_menu', 'acconsentobot_admin_menu' ); /** * Admin page callback for AcconsentoBot settings. */ function acconsentobot_footer_text_admin_page() { $textvar = get_option( 'acconsentobot_footer_variable', 'acconsentobot script' ); if ( isset( $_POST['change-clicked'] ) ) { if ( ! isset( $_POST['my_acconsentobot_update_setting'] ) ) { wp_die( esc_html__( "Hmm .. looks like you didn't send any credentials.. No CSRF for you!", 'acconsentobot' ) ); } if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['my_acconsentobot_update_setting'] ) ), 'acconsentobot-update-setting' ) ) { wp_die( esc_html__( "Hmm .. looks like you didn't send any credentials.. No CSRF for you!", 'acconsentobot' ) ); } if ( isset( $_POST['footertext'] ) ) { $footertext = esc_url_raw( wp_unslash( $_POST['footertext'] ) ); $footerval = explode( '//', $footertext ); update_option( 'acconsentobot_footer_variable', end( $footerval ) ); $textvar = get_option( 'acconsentobot_footer_variable', 'acconsentobot script' ); } } ?>