diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 96cceb11..b4fe3dac 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -31,11 +31,7 @@ class Page extends API { public function __construct() { $settings = Helpers::get_settings(); $domain = Helpers::get_domain(); - $api_token = ! empty( $settings[ 'api_token' ] ) ? $settings[ 'api_token' ] : ''; - $self_hosted_domain = defined( - 'PLAUSIBLE_SELF_HOSTED_DOMAIN' - ) ? PLAUSIBLE_SELF_HOSTED_DOMAIN : ( ! empty( $settings[ 'self_hosted_domain' ] ) ? $settings[ 'self_hosted_domain' ] : '' ); - $excluded_pages = ! empty( $settings[ 'excluded_pages' ] ) ? $settings[ 'excluded_pages' ] : ''; + $self_hosted_domain = defined( 'PLAUSIBLE_SELF_HOSTED_DOMAIN' ) ? PLAUSIBLE_SELF_HOSTED_DOMAIN : $settings[ 'self_hosted_domain' ]; $this->fields = [ 'general' => [ @@ -64,7 +60,7 @@ public function __construct() { 'label' => esc_html__( 'API Token', 'plausible-analytics' ), 'slug' => 'api_token', 'type' => 'text', - 'value' => $api_token, + 'value' => $settings[ 'api_token' ], ], [ 'label' => esc_html__( 'Connect', 'plausible-analytics' ), @@ -221,7 +217,7 @@ public function __construct() { 'label' => esc_html__( 'Excluded pages', 'plausible-analytics' ), 'slug' => 'excluded_pages', 'type' => 'textarea', - 'value' => $excluded_pages, + 'value' => $settings[ 'excluded_pages' ], 'placeholder' => esc_html__( 'E.g.', 'plausible-analytics' @@ -296,12 +292,12 @@ public function __construct() { 'toggle' => '', 'fields' => [ [ - 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), + 'label' => esc_html__( 'Domain name', 'plausible-analytics' ), 'slug' => 'self_hosted_domain', 'type' => 'text', 'value' => $self_hosted_domain, 'placeholder' => 'e.g. ' . Helpers::get_domain(), - 'disabled' => ! empty( Helpers::get_settings()[ 'proxy_enabled' ] ), + 'disabled' => Helpers::proxy_enabled(), ], [ 'label' => __( 'Save', 'plausible-analytics' ), @@ -311,6 +307,42 @@ public function __construct() { ], ], ], + [ + 'label' => esc_html__( 'View stats in your WordPress dashboard', 'plausible-analytics' ), + 'slug' => 'self_hosted_shared_link', + 'type' => 'group', + 'desc' => sprintf( + '