From a6aa9bc9506233b33931167adbfca63f583d93c6 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Mon, 2 Aug 2021 01:14:09 +0530 Subject: [PATCH 01/49] add css for settings header --- assets/src/css/admin/general.scss | 9 +++++++-- assets/src/css/admin/menu.scss | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/assets/src/css/admin/general.scss b/assets/src/css/admin/general.scss index b59fe61..b98b420 100644 --- a/assets/src/css/admin/general.scss +++ b/assets/src/css/admin/general.scss @@ -24,13 +24,14 @@ padding: 0; position: relative; margin: 0 0 0 -20px; + height: 60px; .plausible-analytics-logo { padding: 20px; border-right: 1px solid #f1f1f1; img { - width: 36px; + width: 26px; height: 100%; } } @@ -42,7 +43,11 @@ width: 100%; .plausible-analytics-title { - padding: 20px; + padding: 0 20px; + + h1 { + font-size: 1.4rem; + } } .plausible-analytics-actions { diff --git a/assets/src/css/admin/menu.scss b/assets/src/css/admin/menu.scss index 89e96fc..6ae45d9 100644 --- a/assets/src/css/admin/menu.scss +++ b/assets/src/css/admin/menu.scss @@ -1,3 +1,21 @@ +.plausible-analytics-header-navigation { + background: #fff; + display: flex; + + a { + padding: 1.4rem; + display: flex; + align-items: center; + color: inherit; + text-decoration: none; + outline: none; + + &.active { + font-weight: 600; + box-shadow: inset 0 -3px #5850ec; + } + } +} .plausible-analytics-admin-menu { // padding: 0 !important; From 8e57d992122a63f50f39c4ef6d28827df6563709 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Mon, 2 Aug 2021 01:14:27 +0530 Subject: [PATCH 02/49] add support for new settings page structure --- src/Admin/Settings/Api.php | 32 ++++++ src/Admin/Settings/Page.php | 206 ++++++++++++++++++++++++++++++++++++ src/Plugin.php | 3 +- 3 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 src/Admin/Settings/Api.php create mode 100644 src/Admin/Settings/Page.php diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php new file mode 100644 index 0000000..37c4a6e --- /dev/null +++ b/src/Admin/Settings/Api.php @@ -0,0 +1,32 @@ +id ) { + return; + } + ?> +
+ +
+
+

+
+ render_header_navigation(); ?> +
+
+ id ) { + return; + } + + $current_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : ''; + $tabs = apply_filters( + 'plausible_analytics_settings_navigation_tabs', + [ + 'general' => [ + 'name' => esc_html__( 'General', 'plausible-analytics' ), + 'url' => admin_url( 'options-general.php?page=plausible_analytics' ), + 'class' => '' === $current_tab ? 'active' : '', + ], + 'self-hosted' => [ + 'name' => esc_html__( 'Self Hosted', 'plausible-analytics' ), + 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=selfhosted' ), + 'class' => 'self-hosted' === $current_tab ? 'active' : '', + ], + 'advanced' => [ + 'name' => esc_html__( 'Advanced', 'plausible-analytics' ), + 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=advanced' ), + 'class' => 'advanced' === $current_tab ? 'active' : '', + ], + ] + ); + + // Don't print any markup if we only have one tab. + if ( count( $tabs ) === 1 ) { + return; + } + ?> +
+ %3$s', + esc_url( $tab['url'] ), + esc_attr( $tab['class'] ), + esc_html( $tab['name'] ) + ); + } + ?> +
+ get_header( esc_html__( 'Analytics', 'plausible-analytics' ) ); + + if ( 'true' === $can_embed_analytics && ! empty( $shared_link ) ) { + ?> + + + +
+ %3$s %4$s %5$s %7$s %8$s', + esc_html( 'Please', 'plausible-analytics' ), + esc_url_raw( "https://plausible.io/{$domain}/settings/visibility" ), + esc_html( 'click here', 'plausible-analytics' ), + esc_html( 'to generate your shared link from your Plausible Analytics dashboard. Make sure the link is not password protected.', 'plausible-analytics' ), + esc_html( 'Now, copy the generated shared link and', 'plausible-analytics' ), + admin_url( 'options-general.php?page=plausible-analytics' ), + esc_html( 'paste here', 'plausible-analytics' ), + esc_html( 'under Embed Analytics to view Plausible Analytics dashboard within your WordPress site.', 'plausible-analytics' ) + ); + ?> +

+ Date: Tue, 3 Aug 2021 00:58:25 +0530 Subject: [PATCH 03/49] basic settings page and api setup --- src/Admin/Settings/Api.php | 63 ++++++++++++++++++++++++++++++ src/Admin/Settings/Page.php | 77 +++++++++++++++++++++++++++++++------ 2 files changed, 128 insertions(+), 12 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 37c4a6e..0440226 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -18,6 +18,17 @@ } class API { + + /** + * Admin Setting Fields. + * + * @since 1.3.0 + * @access public + * + * @var array + */ + public $fields = []; + /** * Constructor. * @@ -29,4 +40,56 @@ class API { public function __construct() { } + + /** + * Render Fields. + * + * @since 1.3.0 + * @access public + * + * @return void + */ + public function settings_page() { + $current_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'general'; + ?> +
+
+
+ fields[ $current_tab ] as $tab => $field ) { + call_user_func( [ $this, "render_{$field['type']}_field" ], $field ); + } + ?> +
+
+
+ +
+
+ +
+
+ + + + +
+

+ +

+
+ fields = [ + 'general' => [ + [ + 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), + 'slug' => 'domain_name', + 'type' => 'text', + 'desc' => sprintf( + '%1$s %3$s %4$s', + esc_html__( 'We have fetched the domain name for which Plausible Analytics will be used. We assume that you have already setup the domain on our website.', 'plausible-analytics' ), + esc_url( 'https://docs.plausible.io/register-account' ), + esc_html__( 'Follow these instructions', 'plausible-analytics' ), + esc_html__( 'to add your site to Plausible.', 'plausible-analytics' ) + ), + 'toggle' => false, + ], + [ + 'label' => esc_html__( 'Custom Domain', 'plausible-analytics' ), + 'slug' => 'custom_domain', + 'type' => 'text', + 'desc' => sprintf( + '
  1. %1$s %3$s
  2. %4$s %5$s %6$s %7$s %8$s
', + esc_html__( 'Enable the custom domain functionality in your Plausible account.', 'plausible-analytics' ), + esc_url( 'https://docs.plausible.io/custom-domain/' ), + esc_html__( 'See how »', 'plausible-analytics' ), + esc_html__( 'Enable this setting and configure it to link with Plausible Analytics on your custom domain.', 'plausible-analytics' ), + __( 'For example,', 'plausible-analytics' ), + "stats.$domain", + __( 'or', 'plausible-analytics' ), + "analytics.$domain" + ), + 'toggle' => true, + ], + [ + 'label' => esc_html__( 'View your stats in your WordPress dashboard', 'plausible-analytics' ), + 'slug' => 'custom_domain', + 'type' => 'text', + 'desc' => sprintf( + '
  1. %1$s %3$s
  2. %4$s
  3. %5$s %7$s
', + esc_html__( 'Create a secure & private shared link in your Plausible account. Make sure the link is not password protected.', 'plausible-analytics' ), + esc_url( 'https://plausible.io/docs/shared-links' ), + esc_html__( 'See how »', 'plausible-analytics' ), + esc_html__( 'Enable this setting and paste your shared link to view your stats in your WordPress dashboard.', 'plausible-analytics' ), + esc_html__( 'View your site statistics within your WordPress Dashboard.', 'plausible-analytics' ), + admin_url( 'index.php?page=plausible-analytics-statistics' ), + esc_html__( 'View Statistics »', 'plausible-analytics' ) + ), + 'toggle' => true, + ], + [ + 'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ), + 'slug' => 'track_analytics', + 'type' => 'text', + 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for administrator. If you want to track analytics for administrator then please enable this setting.', 'plausible-analytics' ), + 'toggle' => true, + ], + ], + ]; + add_action( 'admin_menu', [ $this, 'register_menu' ] ); add_action( 'in_admin_header', [ $this, 'render_page_header' ] ); } @@ -147,18 +212,6 @@ public function render_header_navigation() { Date: Thu, 5 Aug 2021 23:53:20 +0530 Subject: [PATCH 04/49] add render text field fn --- src/Admin/Settings/Api.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 0440226..d33d6ba 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -57,7 +57,7 @@ public function settings_page() {
fields[ $current_tab ] as $tab => $field ) { - call_user_func( [ $this, "render_{$field['type']}_field" ], $field ); + echo call_user_func( [ $this, "render_{$field['type']}_field" ], $field ); } ?>
@@ -69,6 +69,14 @@ public function settings_page() {
Date: Fri, 6 Aug 2021 00:49:33 +0530 Subject: [PATCH 05/49] minor css change to make 2 column --- assets/src/css/admin/general.scss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/assets/src/css/admin/general.scss b/assets/src/css/admin/general.scss index b98b420..49a9d57 100644 --- a/assets/src/css/admin/general.scss +++ b/assets/src/css/admin/general.scss @@ -59,10 +59,7 @@ } .plausible-analytics-wrap { - width: 800px; - margin: 0 auto; - margin-top: 50px; - max-width: 100%; + display: flex; .plausible-analytics-admin-field { background-color: #fff; From 3bb33da4cfb200a5aca8f6152392a3eb112bc084 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 6 Aug 2021 00:50:37 +0530 Subject: [PATCH 06/49] align the columns vertically --- src/Admin/Settings/Api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index d33d6ba..a1acbd7 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -63,7 +63,11 @@ public function settings_page() { Date: Fri, 3 Sep 2021 01:52:23 +0530 Subject: [PATCH 07/49] improve and detach text and group field --- src/Admin/Settings/Api.php | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index a1acbd7..a048fcf 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -82,23 +82,52 @@ public function settings_page() { * @return mixed */ public function render_text_field( array $field ) { - $toggle = ! ! $field['toggle']; + ob_start(); + ?> + + +
+
+ +

- +

Date: Fri, 3 Sep 2021 02:23:44 +0530 Subject: [PATCH 08/49] add render checkbox field fn --- src/Admin/Settings/Api.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index a048fcf..41a440c 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -133,4 +133,23 @@ public function render_group_field( array $group ) { + + + + + Date: Fri, 3 Sep 2021 15:54:10 +0530 Subject: [PATCH 09/49] add quick actions related helper fns --- src/Includes/Helpers.php | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/Includes/Helpers.php b/src/Includes/Helpers.php index ad0c198..ad82629 100644 --- a/src/Includes/Helpers.php +++ b/src/Includes/Helpers.php @@ -150,4 +150,63 @@ public static function get_data_api_url() { return $url; } + + /** + * Get Quick Actions. + * + * @since 1.3.0 + * @access public + * + * @return array + */ + public static function get_quick_actions() { + return [ + 'view-docs' => [ + 'label' => esc_html__( 'Documentation', 'plausible-analytics' ), + 'url' => esc_url( 'https://docs.plausible.io/' ), + ], + 'report-issue' => [ + 'label' => esc_html__( 'Report an issue', 'plausible-analytics' ), + 'url' => esc_url( 'https://github.com/plausible/wordpress/issues/new' ), + ], + 'translate-plugin' => [ + 'label' => esc_html__( 'Translate Plugin', 'plausible-analytics' ), + 'url' => esc_url( 'https://translate.wordpress.org/projects/wp-plugins/plausible-analytics/' ), + ], + ]; + } + + /** + * Render Quick Actions + * + * @since 1.3.0 + * @access public + * + * @return mixed + */ + public static function render_quick_actions() { + ob_start(); + $quick_actions = self::get_quick_actions(); + ?> +
+ 0 ) { + ?> +
+ +
+ + + + + +
+ Date: Fri, 3 Sep 2021 16:16:46 +0530 Subject: [PATCH 10/49] add quick actions scss --- assets/src/css/admin/quick-actions.scss | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 assets/src/css/admin/quick-actions.scss diff --git a/assets/src/css/admin/quick-actions.scss b/assets/src/css/admin/quick-actions.scss new file mode 100644 index 0000000..8d057cf --- /dev/null +++ b/assets/src/css/admin/quick-actions.scss @@ -0,0 +1,36 @@ +.plausible-analytics-quick-actions { + display: flex; + flex-wrap: wrap; + align-items: baseline; + background-color: $black-color; + color: $white-color; + padding: 0 15px; + margin-bottom: 20px; + border-radius: 5px; + + ul { + display: flex; + justify-content: space-around; + align-items: center; + + li { + list-style: none; + background-color: $white-color; + margin: 0 5px; + border-radius: 25px; + box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); + -webkit-box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); + -moz-box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); + + a { + text-decoration: none; + color: $base-color; + text-transform: uppercase; + font-weight: 500; + font-size: 12px; + padding: 3px 8px; + display: inline-block; + } + } + } +} From 3d853145f0a17872c87d6c845f9f0c58f1d76914 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 16:19:27 +0530 Subject: [PATCH 11/49] load quick actions helper fn --- src/Admin/Settings/Api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 41a440c..4b9e0a2 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -54,6 +54,7 @@ public function settings_page() { ?>
+
fields[ $current_tab ] as $tab => $field ) { From 79f4857391652e7d6dd501dcd818e27cedd71857 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 16:35:38 +0530 Subject: [PATCH 12/49] improve quick actions related ui and markup --- assets/src/css/admin/quick-actions.scss | 22 ++++++++++++---------- src/Includes/Helpers.php | 16 +++++++++++----- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/assets/src/css/admin/quick-actions.scss b/assets/src/css/admin/quick-actions.scss index 8d057cf..e6c905c 100644 --- a/assets/src/css/admin/quick-actions.scss +++ b/assets/src/css/admin/quick-actions.scss @@ -2,25 +2,29 @@ display: flex; flex-wrap: wrap; align-items: baseline; - background-color: $black-color; - color: $white-color; - padding: 0 15px; - margin-bottom: 20px; + background-color: $white-color; + margin-bottom: 10px; border-radius: 5px; + border: 1px solid $base-color; + + .plausible-analytics-quick-actions-title { + background-color: $base-color; + color: $white-color; + padding: 10px; + margin-right: 5px; + } ul { display: flex; justify-content: space-around; align-items: center; + margin: 0; li { list-style: none; background-color: $white-color; - margin: 0 5px; + margin: 0 8px; border-radius: 25px; - box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); - -webkit-box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); - -moz-box-shadow: 0 0 25px -6px rgba(0, 0, 0, 0.49); a { text-decoration: none; @@ -28,8 +32,6 @@ text-transform: uppercase; font-weight: 500; font-size: 12px; - padding: 3px 8px; - display: inline-block; } } } diff --git a/src/Includes/Helpers.php b/src/Includes/Helpers.php index ad82629..0371b23 100644 --- a/src/Includes/Helpers.php +++ b/src/Includes/Helpers.php @@ -192,17 +192,23 @@ public static function render_quick_actions() { 0 ) { ?> -
- +
+
+ +
From 58b7a1c09a4823ebc3d5d10d2d51abf908653a3c Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:24:46 +0530 Subject: [PATCH 13/49] remove 2 column layout for admin settings --- src/Admin/Settings/Api.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 4b9e0a2..8a1c846 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -53,7 +53,7 @@ public function settings_page() { $current_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'general'; ?>
- Date: Fri, 3 Sep 2021 23:25:57 +0530 Subject: [PATCH 14/49] minor fixes to navigation --- src/Admin/Settings/Page.php | 75 ++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index a5f2c95..2e2fb01 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -28,18 +28,27 @@ class Page extends API { * @return void */ public function __construct() { + $roles = new \WP_Roles(); $settings = Helpers::get_settings(); $domain = ! empty( $settings['domain_name'] ) ? $settings['domain_name'] : Helpers::get_domain(); $custom_domain_prefix = ! empty( $settings['custom_domain_prefix'] ) ? $settings['custom_domain_prefix'] : 'analytics'; $self_hosted_domain = ! empty( $settings['self_hosted_domain'] ) ? $settings['self_hosted_domain'] : 'example.com'; $shared_link = ! empty( $settings['shared_link'] ) ? $settings['shared_link'] : "https://plausible.io/share/{$domain}?auth=XXXXXXXXXXXX"; + if ( ! empty( $roles->get_names() ) ) { + foreach ( $roles->get_names() as $role_slug => $role_name ) { + $user_roles_data[ $role_slug ]['label'] = $role_name; + $user_roles_data[ $role_slug ]['slug'] = $role_slug; + $user_roles_data[ $role_slug ]['type'] = 'checkbox'; + } + } + $this->fields = [ - 'general' => [ + 'general' => [ [ - 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), - 'slug' => 'domain_name', - 'type' => 'text', + 'label' => esc_html__( 'Connect your website with Plausible Analytics', 'plausible-analytics' ), + 'slug' => 'connect_to_plausible_analytics', + 'type' => 'group', 'desc' => sprintf( '%1$s %3$s %4$s', esc_html__( 'We have fetched the domain name for which Plausible Analytics will be used. We assume that you have already setup the domain on our website.', 'plausible-analytics' ), @@ -48,11 +57,19 @@ public function __construct() { esc_html__( 'to add your site to Plausible.', 'plausible-analytics' ) ), 'toggle' => false, + 'fields' => [ + [ + 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), + 'slug' => 'domain_name', + 'type' => 'text', + 'value' => $domain, + ], + ], ], [ - 'label' => esc_html__( 'Custom Domain', 'plausible-analytics' ), + 'label' => esc_html__( 'Setup custom domain with Plausible Analytics', 'plausible-analytics' ), 'slug' => 'custom_domain', - 'type' => 'text', + 'type' => 'group', 'desc' => sprintf( '
  1. %1$s %3$s
  2. %4$s %5$s %6$s %7$s %8$s
', esc_html__( 'Enable the custom domain functionality in your Plausible account.', 'plausible-analytics' ), @@ -65,11 +82,19 @@ public function __construct() { "analytics.$domain" ), 'toggle' => true, + 'fields' => [ + [ + 'label' => esc_html__( 'Custom Domain', 'plausible-analytics' ), + 'slug' => 'custom_domain', + 'type' => 'text', + 'value' => "{$custom_domain_prefix}.{$domain}", + ], + ], ], [ 'label' => esc_html__( 'View your stats in your WordPress dashboard', 'plausible-analytics' ), 'slug' => 'custom_domain', - 'type' => 'text', + 'type' => 'group', 'desc' => sprintf( '
  1. %1$s %3$s
  2. %4$s
  3. %5$s %7$s
', esc_html__( 'Create a secure & private shared link in your Plausible account. Make sure the link is not password protected.', 'plausible-analytics' ), @@ -81,13 +106,43 @@ public function __construct() { esc_html__( 'View Statistics »', 'plausible-analytics' ) ), 'toggle' => true, + 'fields' => [ + [ + 'label' => esc_html__( 'Shared Link', 'plausible-analytics' ), + 'slug' => 'shared_link', + 'type' => 'text', + 'value' => $shared_link, + ], + ], ], [ 'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ), 'slug' => 'track_analytics', - 'type' => 'text', - 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for administrator. If you want to track analytics for administrator then please enable this setting.', 'plausible-analytics' ), + 'type' => 'group', + 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), + 'toggle' => true, + 'fields' => ! empty( $user_roles_data ) ? $user_roles_data : [], + ], + ], + 'self-hosted' => [ + [ + 'label' => esc_html__( 'Self-hosted Plausible Analytics?', 'plausible-analytics' ), + 'slug' => 'self_hosted_plausible_analytics', + 'type' => 'group', + 'desc' => sprintf( + '%1$s %3$s', + esc_html__( 'If you\'re self-hosting Plausible on your own infrastructure, enter the domain name where you installed it to enable the integration with your self-hosted instance. Learn more', 'plausible-analytics' ), + esc_url( 'https://plausible.io/self-hosted-web-analytics/' ), + esc_html__( 'about Plausible Self-Hosted.', 'plausible-analytics' ) + ), 'toggle' => true, + 'fields' => [ + [ + 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), + 'slug' => 'self_hosted_domain', + 'type' => 'text', + ], + ], ], ], ]; @@ -181,7 +236,7 @@ public function render_header_navigation() { ], 'self-hosted' => [ 'name' => esc_html__( 'Self Hosted', 'plausible-analytics' ), - 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=selfhosted' ), + 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=self-hosted' ), 'class' => 'self-hosted' === $current_tab ? 'active' : '', ], 'advanced' => [ From 6b7cf755da399ec247d5af3001c5566100a2b470 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:30:52 +0530 Subject: [PATCH 15/49] show header on analytics page --- src/Admin/Settings/Page.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 2e2fb01..df40104 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -191,7 +191,16 @@ public function render_page_header() { $screen = get_current_screen(); // Bailout, if screen id doesn't match. - if ( 'settings_page_plausible_analytics' !== $screen->id ) { + if ( + ! in_array( + $screen->id, + [ + 'settings_page_plausible_analytics', + 'dashboard_page_plausible_analytics_statistics', + ], + true + ) + ) { return; } ?> @@ -284,7 +293,7 @@ public function statistics_page() { ''; // Display admin header. - // echo $this->get_header( esc_html__( 'Analytics', 'plausible-analytics' ) ); + // echo $this->render( esc_html__( 'Analytics', 'plausible-analytics' ) ); if ( 'true' === $can_embed_analytics && ! empty( $shared_link ) ) { ?> From 03e1ce7f26afa9ee67e30ff48ba4414f526bcfaf Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:36:50 +0530 Subject: [PATCH 16/49] remove legacy code for header --- src/Admin/Settings/Page.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index df40104..911ff18 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -292,9 +292,6 @@ public function statistics_page() { $settings['shared_link'] : ''; - // Display admin header. - // echo $this->render( esc_html__( 'Analytics', 'plausible-analytics' ) ); - if ( 'true' === $can_embed_analytics && ! empty( $shared_link ) ) { ?> From c415e7b8768b8a280008ba2e854777250768ce9e Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:43:04 +0530 Subject: [PATCH 17/49] improve admin settings field --- src/Admin/Settings/Page.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 911ff18..9c5e62c 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -28,17 +28,18 @@ class Page extends API { * @return void */ public function __construct() { - $roles = new \WP_Roles(); - $settings = Helpers::get_settings(); - $domain = ! empty( $settings['domain_name'] ) ? $settings['domain_name'] : Helpers::get_domain(); - $custom_domain_prefix = ! empty( $settings['custom_domain_prefix'] ) ? $settings['custom_domain_prefix'] : 'analytics'; - $self_hosted_domain = ! empty( $settings['self_hosted_domain'] ) ? $settings['self_hosted_domain'] : 'example.com'; - $shared_link = ! empty( $settings['shared_link'] ) ? $settings['shared_link'] : "https://plausible.io/share/{$domain}?auth=XXXXXXXXXXXX"; + $roles = new \WP_Roles(); + $settings = Helpers::get_settings(); + $domain = ! empty( $settings['domain_name'] ) ? $settings['domain_name'] : Helpers::get_domain(); + $self_hosted_domain = ! empty( $settings['self_hosted_domain'] ) ? $settings['self_hosted_domain'] : 'example.com'; + $shared_link = ! empty( $settings['shared_link'] ) ? $settings['shared_link'] : "https://plausible.io/share/{$domain}?auth=XXXXXXXXXXXX"; + $custom_domain = ! empty( $settings['custom_domain'] ) ? $settings['custom_domain'] : "analytics.{$domain}"; + // Prepare user roles data. if ( ! empty( $roles->get_names() ) ) { foreach ( $roles->get_names() as $role_slug => $role_name ) { $user_roles_data[ $role_slug ]['label'] = $role_name; - $user_roles_data[ $role_slug ]['slug'] = $role_slug; + $user_roles_data[ $role_slug ]['slug'] = 'track_analytics'; $user_roles_data[ $role_slug ]['type'] = 'checkbox'; } } @@ -68,7 +69,7 @@ public function __construct() { ], [ 'label' => esc_html__( 'Setup custom domain with Plausible Analytics', 'plausible-analytics' ), - 'slug' => 'custom_domain', + 'slug' => 'is_custom_domain', 'type' => 'group', 'desc' => sprintf( '
  1. %1$s %3$s
  2. %4$s %5$s %6$s %7$s %8$s
', @@ -87,13 +88,13 @@ public function __construct() { 'label' => esc_html__( 'Custom Domain', 'plausible-analytics' ), 'slug' => 'custom_domain', 'type' => 'text', - 'value' => "{$custom_domain_prefix}.{$domain}", + 'value' => $custom_domain, ], ], ], [ 'label' => esc_html__( 'View your stats in your WordPress dashboard', 'plausible-analytics' ), - 'slug' => 'custom_domain', + 'slug' => 'is_shared_link', 'type' => 'group', 'desc' => sprintf( '
  1. %1$s %3$s
  2. %4$s
  3. %5$s %7$s
', @@ -117,7 +118,7 @@ public function __construct() { ], [ 'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ), - 'slug' => 'track_analytics', + 'slug' => 'can_role_track_analytics', 'type' => 'group', 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), 'toggle' => true, @@ -127,7 +128,7 @@ public function __construct() { 'self-hosted' => [ [ 'label' => esc_html__( 'Self-hosted Plausible Analytics?', 'plausible-analytics' ), - 'slug' => 'self_hosted_plausible_analytics', + 'slug' => 'is_self_hosted_plausible_analytics', 'type' => 'group', 'desc' => sprintf( '%1$s %3$s', From 06b0cc120de55104159c8a8a44d274aaa45da4c0 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:50:18 +0530 Subject: [PATCH 18/49] feed the stored or default value to fields --- src/Admin/Settings/Api.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 8a1c846..07928c6 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -95,8 +95,11 @@ public function render_text_field( array $field ) { * @return mixed */ public function render_group_field( array $group ) { - $toggle = ! ! $group['toggle']; - $fields = $group['fields']; + $settings = Helpers::get_settings(); + $toggle = ! ! $group['toggle']; + $fields = $group['fields']; + $field_value = ! empty( $settings[ $group['slug'] ] ) ? $settings[ $group['slug'] ] : false; + $is_checked = checked( $field_value, true, false ); ob_start(); ?>
@@ -106,7 +109,7 @@ public function render_group_field( array $group ) { From 7cff0dee493316b7ef04ad24d70c62a120042449 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Fri, 3 Sep 2021 23:55:35 +0530 Subject: [PATCH 19/49] improve field name attribute --- src/Admin/Settings/Api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 07928c6..505c300 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -81,7 +81,7 @@ public function render_text_field( array $field ) { - + - + Date: Sat, 18 Sep 2021 15:07:54 +0530 Subject: [PATCH 20/49] display necessary user roles only --- src/Admin/Settings/Page.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 9c5e62c..11cb789 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -28,22 +28,12 @@ class Page extends API { * @return void */ public function __construct() { - $roles = new \WP_Roles(); $settings = Helpers::get_settings(); $domain = ! empty( $settings['domain_name'] ) ? $settings['domain_name'] : Helpers::get_domain(); $self_hosted_domain = ! empty( $settings['self_hosted_domain'] ) ? $settings['self_hosted_domain'] : 'example.com'; $shared_link = ! empty( $settings['shared_link'] ) ? $settings['shared_link'] : "https://plausible.io/share/{$domain}?auth=XXXXXXXXXXXX"; $custom_domain = ! empty( $settings['custom_domain'] ) ? $settings['custom_domain'] : "analytics.{$domain}"; - // Prepare user roles data. - if ( ! empty( $roles->get_names() ) ) { - foreach ( $roles->get_names() as $role_slug => $role_name ) { - $user_roles_data[ $role_slug ]['label'] = $role_name; - $user_roles_data[ $role_slug ]['slug'] = 'track_analytics'; - $user_roles_data[ $role_slug ]['type'] = 'checkbox'; - } - } - $this->fields = [ 'general' => [ [ @@ -120,9 +110,14 @@ public function __construct() { 'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ), 'slug' => 'can_role_track_analytics', 'type' => 'group', - 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), + 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users excluding `Subscriber` role. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), 'toggle' => true, - 'fields' => ! empty( $user_roles_data ) ? $user_roles_data : [], + 'fields' => [ + 'administrator' => esc_html__( 'Administrator', 'plausible-analytics' ), + 'editor' => esc_html__( 'Editor', 'plausible-analytics' ), + 'author' => esc_html__( 'Author', 'plausible-analytics' ), + 'contributor' => esc_html__( 'Contributor', 'plausible-analytics' ), + ], ], ], 'self-hosted' => [ From 67a85dbb6ba6314165c3b004bda0b2f9adc42259 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:11:31 +0530 Subject: [PATCH 21/49] improve the display of user roles --- src/Admin/Settings/Page.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 11cb789..aba4940 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -113,10 +113,26 @@ public function __construct() { 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users excluding `Subscriber` role. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), 'toggle' => true, 'fields' => [ - 'administrator' => esc_html__( 'Administrator', 'plausible-analytics' ), - 'editor' => esc_html__( 'Editor', 'plausible-analytics' ), - 'author' => esc_html__( 'Author', 'plausible-analytics' ), - 'contributor' => esc_html__( 'Contributor', 'plausible-analytics' ), + 'administrator' => [ + 'label' => esc_html__( 'Administrator', 'plausible-analytics' ), + 'slug' => 'track_analytics', + 'type' => 'checkbox', + ], + 'editor' => [ + 'label' => esc_html__( 'Editor', 'plausible-analytics' ), + 'slug' => 'track_analytics', + 'type' => 'checkbox', + ], + 'author' => [ + 'label' => esc_html__( 'Author', 'plausible-analytics' ), + 'slug' => 'track_analytics', + 'type' => 'checkbox', + ], + 'contributor' => [ + 'label' => esc_html__( 'Contributor', 'plausible-analytics' ), + 'slug' => 'track_analytics', + 'type' => 'checkbox', + ], ], ], ], From 4bace814da0f3231d8f4b18929d601e99bfe4a44 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:20:37 +0530 Subject: [PATCH 22/49] add save settings btn --- src/Admin/Settings/Api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 505c300..9113c64 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -61,6 +61,9 @@ public function settings_page() { echo call_user_func( [ $this, "render_{$field['type']}_field" ], $field ); } ?> +
+ +
From bccf7942d9cdc6edb183e0fcb673fbc02c95cf01 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:25:31 +0530 Subject: [PATCH 23/49] update description for user role settings --- src/Admin/Settings/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index aba4940..2c41972 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -110,7 +110,7 @@ public function __construct() { 'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ), 'slug' => 'can_role_track_analytics', 'type' => 'group', - 'desc' => esc_html__( 'By default, we won\'t be tracking analytics for any user roles or logged in users excluding `Subscriber` role. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), + 'desc' => esc_html__( 'By default, we won\'t be tracking visits of any of the user roles listed above. If you want to track analytics for specific user roles then please check the specific user role setting.', 'plausible-analytics' ), 'toggle' => true, 'fields' => [ 'administrator' => [ From 2da6c90555a80d4aca11ded69c5f00e12f853d6c Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:32:39 +0530 Subject: [PATCH 24/49] add nonce field for security --- src/Admin/Settings/Api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 9113c64..b54133a 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -63,6 +63,7 @@ public function settings_page() { ?>
+
From 0b4a64810df4971620e81557d328dcac48926d92 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:35:11 +0530 Subject: [PATCH 25/49] update checkbox field api --- src/Admin/Settings/Page.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 2c41972..abd8ac8 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -117,21 +117,25 @@ public function __construct() { 'label' => esc_html__( 'Administrator', 'plausible-analytics' ), 'slug' => 'track_analytics', 'type' => 'checkbox', + 'value' => 'administrator', ], 'editor' => [ 'label' => esc_html__( 'Editor', 'plausible-analytics' ), 'slug' => 'track_analytics', 'type' => 'checkbox', + 'value' => 'editor', ], 'author' => [ 'label' => esc_html__( 'Author', 'plausible-analytics' ), 'slug' => 'track_analytics', 'type' => 'checkbox', + 'value' => 'author', ], 'contributor' => [ 'label' => esc_html__( 'Contributor', 'plausible-analytics' ), 'slug' => 'track_analytics', 'type' => 'checkbox', + 'value' => 'contributor', ], ], ], From 122071686d1cb7f3fd8ebdbc206f7330bbafb6b0 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:41:42 +0530 Subject: [PATCH 26/49] update checkbox field api to support values --- src/Admin/Settings/Api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index b54133a..e8ae8bc 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -145,9 +145,10 @@ public function render_group_field( array $group ) { */ public function render_checkbox_field( array $field ) { ob_start(); + $value = ! empty( $field['value'] ) ? $field['value'] : ''; ?> - + Date: Sat, 18 Sep 2021 15:42:30 +0530 Subject: [PATCH 27/49] set checkbox default value as on --- src/Admin/Settings/Api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index e8ae8bc..5caefc0 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -145,7 +145,7 @@ public function render_group_field( array $group ) { */ public function render_checkbox_field( array $field ) { ob_start(); - $value = ! empty( $field['value'] ) ? $field['value'] : ''; + $value = ! empty( $field['value'] ) ? $field['value'] : 'on'; ?> From 2ff5da02b30d5f4cc621e5eaf44d1359cffd6259 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:44:12 +0530 Subject: [PATCH 28/49] add helper fn to sanitize inputs --- src/Includes/Helpers.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Includes/Helpers.php b/src/Includes/Helpers.php index 0371b23..2ecc66c 100644 --- a/src/Includes/Helpers.php +++ b/src/Includes/Helpers.php @@ -215,4 +215,23 @@ public static function render_quick_actions() { Date: Sat, 18 Sep 2021 15:47:51 +0530 Subject: [PATCH 29/49] save admin settings --- src/Admin/Actions.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Admin/Actions.php b/src/Admin/Actions.php index cedc33a..dfc8985 100644 --- a/src/Admin/Actions.php +++ b/src/Admin/Actions.php @@ -8,7 +8,7 @@ * @subpackage Plausible Analytics */ - namespace Plausible\Analytics\WP\Admin; +namespace Plausible\Analytics\WP\Admin; use Plausible\Analytics\WP\Includes\Helpers; @@ -45,18 +45,26 @@ public function register_assets() { \wp_enqueue_script( 'plausible-admin', PLAUSIBLE_ANALYTICS_PLUGIN_URL . 'assets/dist/js/plausible-admin.js', '', PLAUSIBLE_ANALYTICS_VERSION, true ); } + /** + * Save Admin Settings. + * + * @since 1.3.0 + * @access public + * + * @return void + */ public function save_admin_settings() { - $post_data = $_POST; + $post_data = Helpers::clean( $_POST ); + $settings = Helpers::get_settings(); // Security: Roadblock to check for unauthorized access. check_admin_referer( 'plausible-analytics-settings-roadblock', 'roadblock' ); - // Unset unnecessary posted data to store into database. - unset( $post_data['action'] ); - unset( $post_data['roadblock'] ); + // Prepare new settings. + $new_settings = wp_parse_args( $post_data['plausible_analytics_settings'], $settings ); // Save Settings. - update_option( 'plausible_analytics_settings', $post_data ); + update_option( 'plausible_analytics_settings', $post_data['plausible_analytics_settings'] ); // Send response. wp_send_json_success( From af02be47fbf8877418bbd45528d7d7ac99d42192 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Sat, 18 Sep 2021 15:48:12 +0530 Subject: [PATCH 30/49] resolve issue with storing new settings --- src/Admin/Actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Actions.php b/src/Admin/Actions.php index dfc8985..b174f67 100644 --- a/src/Admin/Actions.php +++ b/src/Admin/Actions.php @@ -64,7 +64,7 @@ public function save_admin_settings() { $new_settings = wp_parse_args( $post_data['plausible_analytics_settings'], $settings ); // Save Settings. - update_option( 'plausible_analytics_settings', $post_data['plausible_analytics_settings'] ); + update_option( 'plausible_analytics_settings', $new_settings ); // Send response. wp_send_json_success( From 3f0584d04f8954f2c0b024afe1fa8a7400cf1b66 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Tue, 28 Sep 2021 23:29:18 +0530 Subject: [PATCH 31/49] minor change to description block --- src/Admin/Settings/Api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 5caefc0..84c7cb2 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -127,9 +127,9 @@ public function render_group_field( array $group ) { } ?>
-

+

-

+
Date: Tue, 28 Sep 2021 23:35:11 +0530 Subject: [PATCH 32/49] show selected value for checkbox --- src/Admin/Settings/Api.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 84c7cb2..7b69070 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -29,6 +29,15 @@ class API { */ public $fields = []; + /** + * Admin Settings. + * + * @since 1.3.0 + * @access public + * + * @var $settings + */ + public $settings; /** * Constructor. * @@ -38,7 +47,7 @@ class API { * @return void */ public function __construct() { - + $this->settings = Helpers::get_settings(); } /** @@ -148,7 +157,12 @@ public function render_checkbox_field( array $field ) { $value = ! empty( $field['value'] ) ? $field['value'] : 'on'; ?> - + settings['track_analytics'], true ), true ); ?> + /> Date: Tue, 28 Sep 2021 23:43:25 +0530 Subject: [PATCH 33/49] add open analytics link --- src/Admin/Settings/Api.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 7b69070..dd7cd31 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -113,6 +113,7 @@ public function render_group_field( array $group ) { $fields = $group['fields']; $field_value = ! empty( $settings[ $group['slug'] ] ) ? $settings[ $group['slug'] ] : false; $is_checked = checked( $field_value, true, false ); + $domain_name = ! empty( $settings['domain_name'] ) ? $settings['domain_name'] : ''; ob_start(); ?>
@@ -125,6 +126,10 @@ public function render_group_field( array $group ) { class="plausible-analytics-switch-checkbox" name="plausible_analytics_settings[]" value="1" type="checkbox"> + + + +
From 2a725434130889de1fdbb330e45e867898456a5d Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Tue, 28 Sep 2021 23:44:22 +0530 Subject: [PATCH 34/49] improve checkbox value handling --- src/Admin/Settings/Api.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index dd7cd31..78c81e8 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -29,15 +29,6 @@ class API { */ public $fields = []; - /** - * Admin Settings. - * - * @since 1.3.0 - * @access public - * - * @var $settings - */ - public $settings; /** * Constructor. * @@ -46,9 +37,7 @@ class API { * * @return void */ - public function __construct() { - $this->settings = Helpers::get_settings(); - } + public function __construct() {} /** * Render Fields. @@ -159,14 +148,15 @@ public function render_group_field( array $group ) { */ public function render_checkbox_field( array $field ) { ob_start(); - $value = ! empty( $field['value'] ) ? $field['value'] : 'on'; + $value = ! empty( $field['value'] ) ? $field['value'] : 'on'; + $settings = Helpers::get_settings(); ?> settings['track_analytics'], true ), true ); ?> + /> From 90cc9e1f4400efa7f007b5f5d2bcd8f3033c3bec Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Tue, 28 Sep 2021 23:55:29 +0530 Subject: [PATCH 35/49] track analytics based on user role --- src/Includes/Actions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Includes/Actions.php b/src/Includes/Actions.php index 0597536..c53a351 100644 --- a/src/Includes/Actions.php +++ b/src/Includes/Actions.php @@ -40,10 +40,14 @@ public function __construct() { * @return void */ public function register_assets() { - $settings = Helpers::get_settings(); + $settings = Helpers::get_settings(); + $user_role = Helpers::get_user_role(); // Bailout, if `administrator` user role accessing frontend. - if ( 'false' === $settings['track_administrator'] && current_user_can( 'manage_options' ) ) { + if ( + ! empty( $user_role ) && + ! in_array( $user_role, $settings['track_analytics'], true ) + ) { return; } From 916fb6e025392f44f5a2580092dfacc6672a8b90 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Tue, 28 Sep 2021 23:56:25 +0530 Subject: [PATCH 36/49] get user role for loggedin user helper fn --- src/Includes/Helpers.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Includes/Helpers.php b/src/Includes/Helpers.php index 2ecc66c..ab31815 100644 --- a/src/Includes/Helpers.php +++ b/src/Includes/Helpers.php @@ -234,4 +234,21 @@ public static function clean( $var ) { return is_scalar( $var ) ? sanitize_text_field( wp_unslash( $var ) ) : $var; } } + + /** + * Get user role for the loggedin user. + * + * @since 1.3.0 + * @access public + * + * @return string + */ + public static function get_user_role() { + global $current_user; + + $user_roles = $current_user->roles; + $user_role = array_shift( $user_roles ); + + return $user_role; + } } From c56cfbf475e57a3a66ca7d8e0ae7d0ee203f3840 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:01:09 +0530 Subject: [PATCH 37/49] update default settings --- src/Plugin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 7cd5a39..9c37f96 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -88,11 +88,11 @@ public function activate( $network_wide = false ) { $is_default_settings_saved = get_option( 'plausible_analytics_is_default_settings_saved', false ); if ( ! $is_default_settings_saved ) { + $domain_name = Helpers::get_domain(); $default_settings = [ - 'domain_name' => Helpers::get_domain(), - 'custom_domain' => false, - 'custom_domain_prefix' => 'analytics', - 'track_administrator' => false, + 'domain_name' => $domain_name, + 'custom_domain' => "analytics.{$domain_name}", + 'track_analytics' => [], ]; update_option( 'plausible_analytics_settings', $default_settings ); From 268f8f8a98a15f490b8136d45ba22c0b1738c843 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:01:35 +0530 Subject: [PATCH 38/49] add and load upgrade routines --- src/Admin/Upgrades.php | 36 ++++++++++++++++++++++++++++++++++++ src/Plugin.php | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/Admin/Upgrades.php diff --git a/src/Admin/Upgrades.php b/src/Admin/Upgrades.php new file mode 100644 index 0000000..3815779 --- /dev/null +++ b/src/Admin/Upgrades.php @@ -0,0 +1,36 @@ + Date: Wed, 29 Sep 2021 00:13:05 +0530 Subject: [PATCH 39/49] add upgrade routine for settings --- src/Admin/Upgrades.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Admin/Upgrades.php b/src/Admin/Upgrades.php index 3815779..31e73ec 100644 --- a/src/Admin/Upgrades.php +++ b/src/Admin/Upgrades.php @@ -10,6 +10,8 @@ namespace Plausible\Analytics\WP\Admin; +use Plausible\Analytics\WP\Includes\Helpers; + // Bailout, if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; @@ -30,7 +32,45 @@ class Upgrades { * @return void */ public function __construct() { + add_action( 'init', [ $this, 'register_routines' ] ); + } + + /** + * Register routines for upgrades. + * + * This is intended for automatic upgrade routines having less resource intensive tasks. + * + * @since 1.3.0 + * @access public + * + * @return void + */ + public function register_routines() { + // Upgrade to version 1.3.0. + if ( version_compare( PLAUSIBLE_ANALYTICS_VERSION, '1.3.0', '<' ) ) { + $this->upgrade_to_130(); + } + + // Add required upgrade routines for future versions here. + } + + public function upgrade_to_130() { + $old_settings = Helpers::get_settings(); + $new_settings = $old_settings; + + $new_settings['is_custom_domain'] = $old_settings['custom_domain']; + $new_settings['custom_domain'] = "{$old_settings['custom_domain_prefix']}.{$old_settings['domain_name']}"; + $new_settings['is_shared_link'] = $old_settings['embed_analytics']; + + if ( $old_settings['track_administrator'] ) { + $new_settings['track_analytics'] = [ 'administrator' ]; + } + + // For self hosted plausible analytics. + $new_settings['is_self_hosted_plausible_analytics'] = $old_settings['is_self_hosted_analytics']; + // Update the new settings. + update_option( 'plausible_analytics_settings', $new_settings ); } } From cee8423342613c9069ae5fb77d22cd01e54f3515 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:14:48 +0530 Subject: [PATCH 40/49] resolve php notice for value param --- src/Admin/Settings/Api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index 78c81e8..ddd4281 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -79,11 +79,12 @@ public function settings_page() { */ public function render_text_field( array $field ) { ob_start(); + $value = ! empty( $field['value'] ) ? $field['value'] : ''; ?> - + Date: Wed, 29 Sep 2021 00:15:40 +0530 Subject: [PATCH 41/49] add self hosted domain value --- src/Admin/Settings/Page.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index abd8ac8..08988cc 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -157,6 +157,7 @@ public function __construct() { 'label' => esc_html__( 'Domain Name', 'plausible-analytics' ), 'slug' => 'self_hosted_domain', 'type' => 'text', + 'value' => $self_hosted_domain, ], ], ], From adde376f88b0ec02c8784b8daaa2c47b16a7a725 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:30:50 +0530 Subject: [PATCH 42/49] disabled advanced tab temporarily --- src/Admin/Settings/Page.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php index 08988cc..3fe0a92 100644 --- a/src/Admin/Settings/Page.php +++ b/src/Admin/Settings/Page.php @@ -265,11 +265,11 @@ public function render_header_navigation() { 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=self-hosted' ), 'class' => 'self-hosted' === $current_tab ? 'active' : '', ], - 'advanced' => [ - 'name' => esc_html__( 'Advanced', 'plausible-analytics' ), - 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=advanced' ), - 'class' => 'advanced' === $current_tab ? 'active' : '', - ], + // 'advanced' => [ + // 'name' => esc_html__( 'Advanced', 'plausible-analytics' ), + // 'url' => admin_url( 'options-general.php?page=plausible_analytics&tab=advanced' ), + // 'class' => 'advanced' === $current_tab ? 'active' : '', + // ], ] ); From 98924496ba8ee461ec69f2679880be9de1cd6677 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:41:06 +0530 Subject: [PATCH 43/49] save admin setting automagically --- assets/src/js/admin/main.js | 48 ++----------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/assets/src/js/admin/main.js b/assets/src/js/admin/main.js index e52457a..38eba83 100644 --- a/assets/src/js/admin/main.js +++ b/assets/src/js/admin/main.js @@ -7,57 +7,13 @@ document.addEventListener( 'DOMContentLoaded', () => { return; } - const tabsWrap = formElement.querySelector( '.plausible-analytics-admin-tabs' ); - const tabs = Array.from( tabsWrap.querySelectorAll( 'a' ) ); - const tabContents = Array.from( formElement.querySelectorAll( '.plausible-analytics-content' ) ); - - tabs.forEach( ( tab ) => { - tab.addEventListener( 'click', ( e ) => { - e.preventDefault(); - const tabName = e.target.getAttribute( 'data-tab' ); - - tabs.map( ( tabElement ) => tabElement.classList.remove( 'active' ) ); - tabContents.map( ( tabContent ) => tabContent.classList.remove( 'plausible-analytics-show' ) ); - - e.target.classList.add( 'active' ); - formElement.querySelector( `#plausible-analytics-content-${ tabName }` ).classList.add( 'plausible-analytics-show' ); - } ); - } ); - - const customDomainElement = formElement.querySelector( 'input[name="plausible_analytics_settings[custom_domain]"]' ); - const selfHostedAnalyticsElement = formElement.querySelector( 'input[name="plausible_analytics_settings[is_self_hosted_analytics]"]' ); - saveSettings.addEventListener( 'click', ( e ) => { e.preventDefault(); + const formData = new FormData( formElement ); - const formData = new FormData(); - const spinner = formElement.querySelector( '.plausible-analytics-spinner' ); - const domainName = formElement.querySelector( 'input[name="plausible_analytics_settings[domain_name]"]' ).value; - const customDomainPrefix = formElement.querySelector( 'input[name="plausible_analytics_settings[custom_domain_prefix]"]' ).value; - const isCustomDomain = null !== customDomainElement ? customDomainElement.checked : false; - const selfHostedDomain = formElement.querySelector( 'input[name="plausible_analytics_settings[self_hosted_domain]"]' ).value; - const isSelfHostedAnalytics = null !== selfHostedAnalyticsElement ? selfHostedAnalyticsElement.checked : false; - const trackAdminElement = formElement.querySelector( 'input[name="plausible_analytics_settings[track_administrator]"]:checked' ); - const isTrackAdmin = null !== trackAdminElement ? parseInt( trackAdminElement.value ) : 0; - const embedAnalyticsElement = formElement.querySelector( 'input[name="plausible_analytics_settings[embed_analytics]"]:checked' ); - const canEmbedAnalytics = null !== embedAnalyticsElement ? parseInt( embedAnalyticsElement.value ) : 0; - const roadBlock = null !== formElement.querySelector( '.plausible-analytics-admin-settings-roadblock' ) ? document.querySelector( '.plausible-analytics-admin-settings-roadblock' ).value : ''; - const sharedLinkElement = formElement.querySelector( 'input[name="plausible_analytics_settings[shared_link]"]' ); - const sharedLink = null !== sharedLinkElement ? sharedLinkElement.value : 0; - - spinner.style.display = 'block'; saveSettings.setAttribute( 'disabled', 'disabled' ); formData.append( 'action', 'plausible_analytics_save_admin_settings' ); - formData.append( 'roadblock', roadBlock ); - formData.append( 'domain_name', domainName ); - formData.append( 'custom_domain', isCustomDomain === true ); - formData.append( 'custom_domain_prefix', customDomainPrefix ); - formData.append( 'is_self_hosted_analytics', isSelfHostedAnalytics === true ); - formData.append( 'self_hosted_domain', selfHostedDomain ); - formData.append( 'embed_analytics', canEmbedAnalytics === 1 ); - formData.append( 'shared_link', sharedLink ); - formData.append( 'track_administrator', isTrackAdmin === 1 ); fetch( ajaxurl, @@ -74,10 +30,10 @@ document.addEventListener( 'DOMContentLoaded', () => { } ).then( response => { if ( response.success ) { saveSettings.querySelector( 'span' ).innerText = saveSettings.getAttribute( 'data-saved-text' ); + saveSettings.removeAttribute( 'disabled' ); } setTimeout( () => { - spinner.style.display = 'none'; saveSettings.removeAttribute( 'disabled' ); saveSettings.querySelector( 'span' ).innerText = saveSettings.getAttribute( 'data-default-text' ); }, 500 ); From 21ad39b5db059c9eb14740bd6028453b17159fca Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:41:39 +0530 Subject: [PATCH 44/49] update the save settings btn markup --- src/Admin/Settings/Api.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index ddd4281..ca4fd04 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -60,7 +60,18 @@ public function settings_page() { } ?>
- +
From ceef666b451db4a97ef131ca10c4b87fd7b1fff5 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:43:32 +0530 Subject: [PATCH 45/49] avoid duplicate roadblock nonce field --- src/Admin/Settings/Api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Admin/Settings/Api.php b/src/Admin/Settings/Api.php index ca4fd04..6f271dc 100644 --- a/src/Admin/Settings/Api.php +++ b/src/Admin/Settings/Api.php @@ -72,7 +72,7 @@ class="plausible-analytics-btn plausible-analytics-save-btn"
- +
From 9bc980a86a49a83f028c333dfc33509097eb72b7 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:44:01 +0530 Subject: [PATCH 46/49] remove settings class as moved it to settings dir --- src/Admin/Settings.php | 313 ----------------------------------------- 1 file changed, 313 deletions(-) delete mode 100644 src/Admin/Settings.php diff --git a/src/Admin/Settings.php b/src/Admin/Settings.php deleted file mode 100644 index f049e08..0000000 --- a/src/Admin/Settings.php +++ /dev/null @@ -1,313 +0,0 @@ - -
- -
-
-

-
- -
-
- get_header( esc_html__( 'Settings', 'plausible-analytics' ) ); - ?> -
-
-
- -
-
-
-
- -
- - - -
-
-

- %3$s %4$s', - esc_html__( 'We have fetched the domain name for which Plausible Analytics will be used. We assume that you have already setup the domain on our website.', 'plausible-analytics' ), - esc_url( 'https://docs.plausible.io/register-account' ), - esc_html__( 'Follow these instructions', 'plausible-analytics' ), - esc_html__( 'to add your site to Plausible.', 'plausible-analytics' ) - ); - ?> -

-
-
-
- - -
-
-
  • %1$s %3$s
  • %4$s %5$s %6$s %7$s %8$s
  • ', - esc_html__( 'Enable the custom domain functionality in your Plausible account.', 'plausible-analytics' ), - esc_url( 'https://docs.plausible.io/custom-domain/' ), - esc_html__( 'See how »', 'plausible-analytics' ), - esc_html__( 'Enable this setting and configure it to link with Plausible Analytics on your custom domain.', 'plausible-analytics' ), - __( 'For example,', 'plausible-analytics' ), - "stats.$domain", - __( 'or', 'plausible-analytics' ), - "analytics.$domain" - ); - - ?> -
    -
    -
    -
    - - -
    -
    - -
    -
    -
  • %1$s %3$s
  • %4$s
  • %5$s %7$s
  • ', - esc_html__( 'Create a secure & private shared link in your Plausible account. Make sure the link is not password protected.', 'plausible-analytics' ), - esc_url( 'https://plausible.io/docs/shared-links' ), - esc_html__( 'See how »', 'plausible-analytics' ), - esc_html__( 'Enable this setting and paste your shared link to view your stats in your WordPress dashboard.', 'plausible-analytics' ), - esc_html__( 'View your site statistics within your WordPress Dashboard.', 'plausible-analytics' ), - admin_url( 'index.php?page=plausible-analytics-statistics' ), - esc_html__( 'View Statistics »', 'plausible-analytics' ) - ); - ?> -
    -
    -
    -
    - - -
    -

    - -

    -
    -
    - -
    -
    -
    - - -
    -
    - %3$s', - esc_html__( 'If you\'re self-hosting Plausible on your own infrastructure, enter the domain name where you installed it to enable the integration with your self-hosted instance. Learn more', 'plausible-analytics' ), - esc_url( 'https://plausible.io/self-hosted-web-analytics/' ), - esc_html__( 'about Plausible Self-Hosted.', 'plausible-analytics' ) - ); - - ?> -
    -
    -
    -
    -
    - - -
    -
    -
    -
    - get_header( esc_html__( 'Analytics', 'plausible-analytics' ) ); - - if ( 'true' === $can_embed_analytics && ! empty( $shared_link ) ) { - ?> - - - -
    - %3$s %4$s %5$s %7$s %8$s', - esc_html( 'Please', 'plausible-analytics' ), - esc_url_raw( "https://plausible.io/{$domain}/settings/visibility" ), - esc_html( 'click here', 'plausible-analytics' ), - esc_html( 'to generate your shared link from your Plausible Analytics dashboard. Make sure the link is not password protected.', 'plausible-analytics' ), - esc_html( 'Now, copy the generated shared link and', 'plausible-analytics' ), - admin_url( 'options-general.php?page=plausible-analytics' ), - esc_html( 'paste here', 'plausible-analytics' ), - esc_html( 'under Embed Analytics to view Plausible Analytics dashboard within your WordPress site.', 'plausible-analytics' ) - ); - ?> -

    - Date: Wed, 29 Sep 2021 00:49:11 +0530 Subject: [PATCH 47/49] add scss variable --- assets/src/css/admin/_variables.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/src/css/admin/_variables.scss b/assets/src/css/admin/_variables.scss index 505a5eb..931305f 100644 --- a/assets/src/css/admin/_variables.scss +++ b/assets/src/css/admin/_variables.scss @@ -1 +1,3 @@ $base-color: #5850ec; +$white-color: #fff; +$black-color: #1f2937; From e0f7d709164d3e983f20857040569866c93f075c Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:53:08 +0530 Subject: [PATCH 48/49] some other scss files for decoupled css --- assets/src/css/admin/general.scss | 96 +++++++++++----------------- assets/src/css/admin/header.scss | 39 +++++++++++ assets/src/css/admin/main.scss | 2 + assets/src/css/admin/responsive.scss | 5 ++ 4 files changed, 83 insertions(+), 59 deletions(-) create mode 100644 assets/src/css/admin/header.scss create mode 100644 assets/src/css/admin/responsive.scss diff --git a/assets/src/css/admin/general.scss b/assets/src/css/admin/general.scss index 49a9d57..ea71ed4 100644 --- a/assets/src/css/admin/general.scss +++ b/assets/src/css/admin/general.scss @@ -1,65 +1,24 @@ -.plausible-analytics-hidden { - display: none; -} - -.plausible-analytics-show { - display: block; -} - -.plausible-analytics-content { - @extend .plausible-analytics-hidden; -} - -.plausible-analytics-statistics-not-loaded { - margin: 20px 0 0 -10px; - padding: 0 30px; - font-size: 15px; - line-height: 24px; -} - -.plausible-analytics-header { +.plausible-analytics-wrap { display: flex; - align-items: center; - background-color: #fff; - padding: 0; - position: relative; - margin: 0 0 0 -20px; - height: 60px; - - .plausible-analytics-logo { - padding: 20px; - border-right: 1px solid #f1f1f1; - - img { - width: 26px; - height: 100%; - } - } - - .plausible-analytics-header-content { - display: inline-flex; - justify-content: space-between; - align-items: center; - width: 100%; - .plausible-analytics-title { - padding: 0 20px; + input[type='text'] { + background-color: #f5f5f5; + border: none; + border-radius: 5px; + } - h1 { - font-size: 1.4rem; - } - } + input[name='shared_link'] { + width: 75%; + } - .plausible-analytics-actions { - display: flex; - margin-left: auto; - padding: 20px; - } + .plausible-checkbox-list { + margin: 3px 0; + display: inline-block; } -} -.plausible-analytics-wrap { - display: flex; + .plausible-analytics-content { + width: 800px; + } .plausible-analytics-admin-field { background-color: #fff; @@ -87,12 +46,16 @@ align-items: center; } + .plausible-analytics-admin-field-body { + padding: 10px 0 10px 0; + margin: 15px 0 15px 0; + border-top: 1px dashed #e5e5e5; + border-bottom: 1px dashed #e5e5e5; + } + .plausible-analytics-description { font-style: italic; color: #989898; - border-top: 1px dashed #e5e5e5; - padding: 10px 0 0 0; - margin: 15px 0 0 0; ol { margin: 5px 15px; @@ -106,3 +69,18 @@ } } } + +.plausible-analytics-hidden { + display: none; +} + +.plausible-analytics-show { + display: block; +} + +.plausible-analytics-statistics-not-loaded { + margin: 20px 0 0 -10px; + padding: 0 30px; + font-size: 15px; + line-height: 24px; +} diff --git a/assets/src/css/admin/header.scss b/assets/src/css/admin/header.scss new file mode 100644 index 0000000..6a12253 --- /dev/null +++ b/assets/src/css/admin/header.scss @@ -0,0 +1,39 @@ +.plausible-analytics-header { + display: flex; + align-items: center; + background-color: #fff; + padding: 0; + position: relative; + margin: 0 0 0 -20px; + height: 60px; + + .plausible-analytics-logo { + padding: 20px; + border-right: 1px solid #f1f1f1; + + img { + width: 26px; + height: 100%; + } + } + + .plausible-analytics-header-content { + display: inline-flex; + align-items: center; + width: 100%; + + .plausible-analytics-title { + padding: 0 20px; + + h1 { + font-size: 1.4rem; + } + } + + .plausible-analytics-actions { + display: flex; + margin-left: auto; + padding: 20px; + } + } +} diff --git a/assets/src/css/admin/main.scss b/assets/src/css/admin/main.scss index c9e536b..e0988da 100644 --- a/assets/src/css/admin/main.scss +++ b/assets/src/css/admin/main.scss @@ -1,6 +1,8 @@ @import './_variables'; @import './_mixins'; @import './menu.scss'; +@import './quick-actions.scss'; +@import './header.scss'; @import './general.scss'; @import './switch.scss'; @import './trigger.scss'; diff --git a/assets/src/css/admin/responsive.scss b/assets/src/css/admin/responsive.scss new file mode 100644 index 0000000..6a3fa78 --- /dev/null +++ b/assets/src/css/admin/responsive.scss @@ -0,0 +1,5 @@ +@media screen and (max-width: 1024px) { + .plausible-analytics-content { + width: 100%; + } +} From 65b34e8f6386a3d76acde79d40bde70602ac1f28 Mon Sep 17 00:00:00 2001 From: Mehul Gohil Date: Wed, 29 Sep 2021 00:56:41 +0530 Subject: [PATCH 49/49] add rough readme for 1.3.0 --- readme.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.txt b/readme.txt index dbecad7..4f36697 100644 --- a/readme.txt +++ b/readme.txt @@ -149,6 +149,11 @@ Please make sure you make a backup of your database before updating any version == Changelog == += 1.3.0 = +- 40-45% reduction in JS code +- Exclude the roles editor and author [#11](https://github.com/plausible/wordpress/issues/11) +- Improve settings page to future proof new settings [#26](https://github.com/plausible/wordpress/issues/26) + = 1.2.2 = - Resolve conflicts with WP Rocket plugin.