diff --git a/src/Admin/Settings/API.php b/src/Admin/Settings/API.php index dffd528d..2e519f3e 100644 --- a/src/Admin/Settings/API.php +++ b/src/Admin/Settings/API.php @@ -62,7 +62,7 @@ public function settings_page() { $this->slides = [ 'welcome' => __( 'Welcome to Plausible Analytics', 'plausible-analytics' ), 'domain_name' => __( 'Confirm domain', 'plausible-analytics' ), - 'api_token' => __( 'Create API token', 'plausible-analytics' ), + 'api_token' => __( 'Create Plugin Token', 'plausible-analytics' ), 'enable_analytics_dashboard' => __( 'View the stats in your WP dashboard', 'plausible-analytics' ), 'enhanced_measurements' => __( 'Enhanced measurements', 'plausible-analytics' ), 'proxy_enabled' => __( 'Enable proxy', 'plausible-analytics' ), @@ -82,7 +82,7 @@ public function settings_page() { 'plausible-analytics' ), 'api_token' => __( - 'Create an API token (link opens in a new window) that we\'ll use to automate your setup process. Paste the API token in the field below and click "Next".', + 'Create a Plugin Token (link opens in a new window) that we\'ll use to automate your setup process. Paste the Plugin Token in the field below and click "Next".', 'plausible-analytics' ), 'enable_analytics_dashboard' => __( @@ -135,11 +135,11 @@ public function settings_page() { 'plausible-analytics' ), __( - 'For instance, after inserting the API token, enable the new Authors and categories tracking and it will be displayed in your stats immediately without you needing to add those properties manually in your site settings.', + 'For instance, after inserting the Plugin Token, enable the new Authors and categories tracking and it will be displayed in your stats immediately without you needing to add those properties manually in your site settings.', 'plausible-analytics' ), __( - 'This welcome screen will guide you through the process of creating the API token and introduce you to other new features we\'ve added, e.g. Revenue tracking. Click on the “Next” button below to start.', + 'This welcome screen will guide you through the process of creating the Plugin Token and introduce you to other new features we\'ve added, e.g. Revenue tracking. Click on the “Next” button below to start.', 'plausible-analytics' ), __( 'We hope you’ll find this useful. Thanks again for using Plausible!', 'plausible-analytics' ) @@ -618,7 +618,7 @@ public function render_text_field( array $field ) { ?>
+ for="">
create an API token and insert it into the API token field above.', + 'Please create a Plugin Token and insert it into the Plugin Token field above.', 'plausible-analytics' ), 'post' @@ -179,14 +179,14 @@ public function missing_api_token_warning() { } /** - * Display option disabled by missing API token warning. + * Display option disabled by missing Plugin Token warning. * * @output HTML */ public function option_disabled_by_missing_api_token() { echo wp_kses( __( - 'Please create an API token and insert it into the API token field above to enable this option.', + 'Please create a Plugin Token and insert it into the Plugin Token field above to enable this option.', 'plausible-analytics' ), 'post' diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 6162af7e..368e9594 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -80,7 +80,7 @@ public function __construct() { 'desc' => sprintf( wp_kses( __( - 'Ensure your domain name matches the one in your Plausible account, then create an API token (link opens in a new window) and paste it into the \'API token\' field.', + 'Ensure your domain name matches the one in your Plausible account, then create a Plugin Token (link opens in a new window) and paste it into the \'Plugin Token\' field.', 'plausible-analytics' ), 'post' @@ -95,7 +95,11 @@ public function __construct() { 'value' => Helpers::get_domain(), ], [ - 'label' => esc_html__( 'API token', 'plausible-analytics' ), + 'label' => esc_html__( 'Plugin Token', 'plausible-analytics' ) . + ' - ' . + '' . + __( 'Create Token', 'plausible-analytics' ) . + '', 'slug' => 'api_token', 'type' => 'text', 'value' => $settings[ 'api_token' ], @@ -413,7 +417,7 @@ public function __construct() { } /** - * No API token is entered. + * No Plugin Token is entered. */ if ( empty( $settings[ 'api_token' ] ) ) { $this->fields[ 'general' ][ 0 ][ 'fields' ][] = self::API_TOKEN_MISSING_HOOK; diff --git a/src/Ajax.php b/src/Ajax.php index 5d9fbc4b..55facca2 100644 --- a/src/Ajax.php +++ b/src/Ajax.php @@ -284,7 +284,7 @@ public function save_options() { // Clean spaces $settings[ $option->name ] = trim( $option->value ); - // Validate API token, if this is the API token field. + // Validate Plugin Token, if this is the Plugin Token field. if ( $option->name === 'api_token' ) { $this->validate_api_token( $option->value ); } @@ -298,7 +298,7 @@ public function save_options() { } /** - * Validate the entered API token, before storing it to the DB. wp_send_json_error() ensures that code execution stops. + * Validate the entered Plugin Token, before storing it to the DB. wp_send_json_error() ensures that code execution stops. * * @param string $token * @@ -310,9 +310,12 @@ private function validate_api_token( $token = '' ) { if ( ! $client->validate_api_token() ) { Messages::set_error( - __( - 'Oops! The API token you used is invalid. Please click here to generate a new token.', - 'plausible-analytics' + sprintf( + __( + 'Oops! The Plugin Token you used is invalid. Please click here to generate a new token. Read more', + 'plausible-analytics' + ), + 'https://plausible.io/wordpress-analytics-plugin#oops-the-token-you-used-is-invalid' ) ); diff --git a/src/Client.php b/src/Client.php index 8596e9a6..0712ab21 100644 --- a/src/Client.php +++ b/src/Client.php @@ -40,7 +40,7 @@ public function __construct( $token = '' ) { } /** - * Validates the API token (password) set in the current instance and caches the state to a transient valid for 1 day. + * Validates the Plugin Token (password) set in the current instance and caches the state to a transient valid for 1 day. * * @return bool * @throws ApiException @@ -83,7 +83,7 @@ private function get_features() { } /** - * Retrieve all capabilities assigned to configured API token. + * Retrieve all capabilities assigned to configured Plugin Token. * * @return bool|Client\Model\Capabilities *