Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Tour/API.php')
-rw-r--r--plugins/Tour/API.php37
1 files changed, 34 insertions, 3 deletions
diff --git a/plugins/Tour/API.php b/plugins/Tour/API.php
index 72c61e1a6e..5782df9e86 100644
--- a/plugins/Tour/API.php
+++ b/plugins/Tour/API.php
@@ -9,6 +9,7 @@
namespace Piwik\Plugins\Tour;
use Piwik\Piwik;
+use Piwik\SiteContentDetector;
use Piwik\Plugins\Tour\Engagement\Levels;
use Piwik\Plugins\Tour\Engagement\Challenges;
@@ -30,10 +31,14 @@ class API extends \Piwik\Plugin\API
*/
private $levels;
- public function __construct(Challenges $challenges, Levels $levels)
+ /** @var SiteContentDetector */
+ private $siteContentDetector;
+
+ public function __construct(Challenges $challenges, Levels $levels, SiteContentDetector $siteContentDetector)
{
$this->challenges = $challenges;
$this->levels = $levels;
+ $this->siteContentDetector = $siteContentDetector;
}
/**
@@ -48,20 +53,46 @@ class API extends \Piwik\Plugin\API
$challenges = array();
foreach ($this->challenges->getChallenges() as $challenge) {
- $challenges[] = array(
+
+ if ($challenge->isDisabled()) {
+ continue;
+ }
+
+ $challenges[] = [
'id' => $challenge->getId(),
'name' => $challenge->getName(),
'description' => $challenge->getDescription(),
'isCompleted' => $challenge->isCompleted(),
'isSkipped' => $challenge->isSkipped(),
'url' => $challenge->getUrl()
- );
+ ];
}
return $challenges;
}
/**
+ * Detect consent manager details for a site
+ *
+ * @return null|array[]
+ * @internal
+ */
+ public function detectConsentManager($idSite, $timeOut = 60)
+ {
+ Piwik::checkUserHasViewAccess($idSite);
+
+ $this->siteContentDetector->detectContent([SiteContentDetector::CONSENT_MANAGER]);
+ if ($this->siteContentDetector->consentManagerId) {
+ return ['name' => $this->siteContentDetector->consentManagerName,
+ 'url' => $this->siteContentDetector->consentManagerUrl,
+ 'isConnected' => $this->siteContentDetector->isConnected
+ ];
+ }
+
+ return null;
+ }
+
+ /**
* Skip a specific challenge.
*
* @param string $id