Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ Please make sure you make a backup of your database before updating any version
== Changelog ==

= 2.6.1 =
* Added: info icons linking to the documentation for Cloaked Affiliate Links, Query Parameters, View Your Stats in Your WordPress Dashboard, Track Analytics for User Roles, Show Stats Dashboard to
Additional User Roles and Disable Menu in Toolbar.
* Fixed: the Getting Started Guide's Next button would stay disabled after entering (or pasting) a Plugin Token.

= 2.6.0 =
Expand Down
47 changes: 39 additions & 8 deletions src/Admin/Settings/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,45 @@ public function render_checkbox_field( array $field, $is_list = false ) {
<?php echo $this->render_hook_field( reset( $field['disabled_tooltip'] ), $show_disabled_tooltip ); ?>
<?php endif; ?>
<span class="ml-2 dark:text-gray-100 text-lg"><?php echo esc_html( $field['label'] ); ?></span>
<?php if ( isset( $field['docs'] ) ): ?>
<a class="leading-none" href="<?php echo esc_url( $field['docs'] ); ?>" rel="noreferrer" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" class="text-gray-400 w-6 h-6 leading-none" stroke="currentColor" aria-hidden="true" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
<path stroke-linecap="round" stroke-linejoin="round"
d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path>
</svg>
</a>
<?php if ( ! empty( $field['docs'] ) ): ?>
<?php echo $this->render_docs_link( $field['docs'], $field['label'] ); ?>
<?php endif; ?>
</div>
<?php
return ob_get_clean();
}

/**
* Renders an info icon, linking to the documentation of the option/section it belongs to.
*
* @since 2.6.1
* @access public
*
* @param string $url URL to the documentation.
* @param string $label Label of the option/section, used as the link's accessible name.
*
* @return string
*/
public function render_docs_link( $url, $label = '' ) {
$title = $label ? sprintf(
// translators: %s: Label of the option/section this link belongs to.
__( 'Learn more about %s', 'plausible-analytics' ),
$label
) : __( 'Learn more', 'plausible-analytics' );

ob_start();
?>
<a class="inline-flex items-center leading-none" href="<?php echo esc_url( $url ); ?>" rel="noreferrer" target="_blank" aria-label="<?php echo esc_attr( $title ); ?>"
title="<?php echo esc_attr( $title ); ?>">
<svg xmlns="http://www.w3.org/2000/svg" class="text-gray-400 w-6 h-6 leading-none" stroke="currentColor" aria-hidden="true" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
<path stroke-linecap="round" stroke-linejoin="round"
d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path>
</svg>
</a>
<?php
return ob_get_clean();
}

/**
* Render just the label, and allow insertion of anything using the hook beside it.
*
Expand Down Expand Up @@ -398,7 +424,12 @@ public function render_group_field( array $group, $hide_header = false ) {
<div class="bg-white dark:bg-gray-800<?php echo $hide_header ? '' : ' plausible-analytics-group py-6 px-4 space-y-6 sm:p-6'; ?>">
<?php if ( ! $hide_header ) : ?>
<header class="relative">
<h3 class="text-lg mt-0 leading-6 font-medium text-gray-900 dark:text-gray-100" id="<?php echo esc_attr( $group['slug'] ); ?>"><?php echo esc_html( $group['label'] ); ?></h3>
<div class="flex items-start gap-x-2">
<h3 class="text-lg mt-0 leading-6 font-medium text-gray-900 dark:text-gray-100" id="<?php echo esc_attr( $group['slug'] ); ?>"><?php echo esc_html( $group['label'] ); ?></h3>
<?php if ( ! empty( $group['docs'] ) ): ?>
<?php echo $this->render_docs_link( $group['docs'], $group['label'] ); ?>
<?php endif; ?>
</div>
<div class="mt-1 text-sm leading-5 !text-gray-500 !dark:text-gray-200">
<?php echo wp_kses_post( $group['desc'] ); ?>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/Admin/Settings/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function __construct() {
'label' => esc_html__( 'Cloaked affiliate links', 'plausible-analytics' ),
'slug' => 'cloaked_affiliate_links',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#cloaked-affiliate-links',
'desc' => sprintf(
// translators: %s: Example URL to affiliate product.
__(
Expand All @@ -218,6 +219,7 @@ public function __construct() {
'label' => esc_html__( 'Query parameters', 'plausible-analytics' ),
'slug' => 'query_params',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#query-parameters',
'desc' => sprintf(
// translators: %s: Example URL with query parameter.
__(
Expand Down Expand Up @@ -272,6 +274,7 @@ public function __construct() {
'label' => esc_html__( 'View your stats in your WordPress dashboard', 'plausible-analytics' ),
'slug' => 'is_shared_link',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#view-your-stats-inside-wordpress',
'desc' => esc_html__(
'View your site statistics within your WordPress Dashboard.',
'plausible-analytics'
Expand Down Expand Up @@ -323,6 +326,7 @@ public function __construct() {
'label' => esc_html__( 'Track analytics for user roles', 'plausible-analytics' ),
'slug' => 'tracked_user_roles',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#exclude-admins-and-other-roles',
'desc' => esc_html__(
'By default, visits from logged in users aren\'t tracked. If you want to track visits for certain user roles then please specify them below.',
'plausible-analytics'
Expand All @@ -334,6 +338,7 @@ public function __construct() {
'label' => esc_html__( 'Show stats dashboard to additional user roles', 'plausible-analytics' ),
'slug' => 'expand_dashboard_access',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#view-your-stats-inside-wordpress',
'desc' => esc_html__(
'By default, the stats dashboard is only available to logged in administrators. If you want the dashboard to be available for other logged in users, then please specify them below.',
'plausible-analytics'
Expand All @@ -345,6 +350,7 @@ public function __construct() {
'label' => esc_html__( 'Disable menu in toolbar', 'plausible-analytics' ),
'slug' => 'disable_toolbar_menu',
'type' => 'group',
'docs' => 'https://plausible.io/docs/wordpress-integration#disable-the-toolbar-menu',
'desc' => esc_html__(
'Check this option if you don\'t want the Plausible Analytics menu item to be added to the toolbar at the top of the screen.',
'plausible-analytics'
Expand Down
Loading