get_options(); $nonce = wp_create_nonce( 'advads-mapi' ); $CID = Advanced_Ads_AdSense_MAPI::CID; $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app(); if ( $use_user_app ) { $CID = ADVANCED_ADS_MAPI_CID; } $state = [ 'api' => 'adsense', 'nonce' => $nonce, 'return_url' => admin_url( 'admin.php?page=advanced-ads-settings&oauth=1#top#adsense' ), ]; $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages(); $auth_url = 'https://accounts.google.com/o/oauth2/v2/auth?scope=' . urlencode( 'https://www.googleapis.com/auth/adsense.readonly' ) . '&client_id=' . $CID . '&redirect_uri=' . urlencode( Advanced_Ads_AdSense_MAPI::REDIRECT_URI ) . '&state=' . urlencode( base64_encode( wp_json_encode( $state ) ) ) . '&access_type=offline&include_granted_scopes=true&prompt=consent&response_type=code'; $_get = wp_unslash( $_GET ); if ( isset( $_get['oauth'] ) && '1' == $_get['oauth'] && isset( $_get['api'] ) && 'adsense' == $_get['api'] ) : ?>

...