'sanitize_text_field' ]); register_setting('adpagex_settings_group', 'adpagex_debug', [ 'sanitize_callback' => function($value) { return $value === '1' ? '1' : '0'; } ]); } /** * Renders the AdPageX settings page. * */ public function render_settings_page() { $configs = get_option('adpagex_configurations', []); $active = get_option('adpagex_active_config'); // Handle settings form submission (General Settings) if ( isset($_POST['submit']) && current_user_can('manage_options') && isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'adpagex_settings_save') ) { $api_url = isset($_POST['adpagex_api_url']) ? sanitize_text_field(wp_unslash($_POST['adpagex_api_url'])) : ''; update_option('adpagex_api_url', $api_url); update_option('adpagex_debug', isset($_POST['adpagex_debug']) ? '1' : '0'); echo '
Settings saved successfully!
Settings saved successfully!
Error: Publisher ID must be in the format partner-pub-xxxxxxxxxxxxxxx.
Error: Style ID must be a number.
' . esc_html__( 'Error: Could not fetch script from API. Please check your Publisher ID and Style ID.', 'adpagex' ) . '