PluginProbe
Metricool – Social media and site statistics / 2.1.1
Metricool – Social media and site statistics v2.1.1
2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
← All changes | app/Features/TaskManagement/Tasks/UnableToTrackTrafficTask.php +49 -0 2.0.0 → 2.1.1 View file →
@@ -1,0 +1,49 @@
1 +<?php
2 +
3 +declare(strict_types=1);
4 +
5 +namespace Metricool\Features\TaskManagement\Tasks;
6 +
7 +// todo - add listener
8 +class UnableToTrackTrafficTask extends AbstractTask
9 +{
10 + public const IDENTIFIER = 'unable_to_track_traffic';
11 +
12 + /**
13 + * This task is hidden by default as a user should have a working Metricool
14 + * script by default. Only show the task if it has an active state, never
15 + * in a completed state. That looks weird while filtering.
16 + */
17 + public function __construct()
18 + {
19 + $this->hide();
20 + }
21 +
22 + /**
23 + * @inheritDoc
24 + */
25 + public function getText(): string
26 + {
27 + return __('Unable to track traffic on your site', 'metricool');
28 + }
29 +
30 + /**
31 + * @inheritDoc
32 + */
33 + public function getAction(): array
34 + {
35 + // todo - fetch from settings
36 + $queryArgs = array_filter([
37 + 'blogId' => (defined('METRICOOL_BLOG_ID') ? METRICOOL_BLOG_ID : ''),
38 + 'userId' => (defined('METRICOOL_USER_ID') ? METRICOOL_USER_ID : ''),
39 + ]);
40 +
41 + $link = add_query_arg($queryArgs, 'https://app.metricool.com/evolution/web');
42 +
43 + return [
44 + 'text' => __('Validate connection', 'metricool'),
45 + 'link' => $link,
46 + 'target' => '_blank',
47 + ];
48 + }
49 +}