| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/piwik/plugins/Tour/Engagement/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Tour\Engagement;
use Piwik\Container\StaticContainer;
use Piwik\Piwik;
use Piwik\Plugin;
use Piwik\Plugins\CoreAdminHome\Controller;
use Piwik\Plugins\SitesManager\SitesManager;
use Piwik\Plugins\Tour\Dao\DataFinder;
use Piwik\Plugins\UserCountry\UserCountry;
use Piwik\Plugins\UsersManager\UsersManager;
class Challenges
{
/**
* @var DataFinder
*/
private $finder;
public function __construct(DataFinder $dataFinder)
{
$this->finder = $dataFinder;
}
private function isActivePlugin($pluginName)
{
return Plugin\Manager::getInstance()->isPluginActivated($pluginName);
}
public function getChallenges()
{
/** @var Challenge[] $challenges */
$challenges = array(
StaticContainer::get(ChallengeTrackingCode::class),
);
if ($this->isActivePlugin('Goals')) {
$challenges[] = StaticContainer::get(ChallengeCreatedGoal::class);
}
$challenges[] = StaticContainer::get(ChallengeCustomLogo::class);
if ($this->isActivePlugin('UsersManager') && UsersManager::isUsersAdminEnabled()) {
$challenges[] = StaticContainer::get(ChallengeAddedUser::class);
}
if ($this->isActivePlugin('SitesManager') && SitesManager::isSitesAdminEnabled()) {
$challenges[] = StaticContainer::get(ChallengeAddedWebsite::class);
}
$challenges[] = StaticContainer::get(ChallengeFlattenActions::class);
$challenges[] = StaticContainer::get(ChallengeChangeVisualisation::class);
if ($this->isActivePlugin('ScheduledReports')) {
$challenges[] = StaticContainer::get(ChallengeScheduledReport::class);
}
if ($this->isActivePlugin('Dashboard')) {
$challenges[] = StaticContainer::get(ChallengeCustomiseDashboard::class);
}
if ($this->isActivePlugin('SegmentEditor')) {
$challenges[] = StaticContainer::get(ChallengeAddedSegment::class);
}
if ($this->isActivePlugin('Annotations')) {
$challenges[] = StaticContainer::get(ChallengeAddedAnnotation::class);
}
if ($this->isActivePlugin('TwoFactorAuth')) {
$challenges[] = StaticContainer::get(ChallengeSetupTwoFa::class);
}
if (Controller::isGeneralSettingsAdminEnabled()) {
$challenges[] = StaticContainer::get(ChallengeDisableBrowserArchiving::class);
}
if (UserCountry::isGeoLocationAdminEnabled()) {
$challenges[] = StaticContainer::get(ChallengeConfigureGeolocation::class);
}
// we're adding this simple challenge only later in the process since there might not be enough data yet in
// the beginning to actually get much value from it
$challenges[] = StaticContainer::get(ChallengeSelectDateRange::class);
if ($this->isActivePlugin('Live')) {
$challenges[] = StaticContainer::get(ChallengeViewVisitsLog::class);
$challenges[] = StaticContainer::get(ChallengeViewVisitorProfile::class);
}
$challenges[] = StaticContainer::get(ChallengeViewRowEvolution::class);
if ($this->isActivePlugin('Marketplace')) {
$challenges[] = StaticContainer::get(ChallengeBrowseMarketplace::class);
}
/**
* Triggered to add new challenges to the "welcome to Matomo tour".
*
* **Example**
*
* public function addChallenge(&$challenges)
* {
* $challenges[] = new MyChallenge();
* }
*
* @param Challenge[] $challenges An array of challenges
*/
Piwik::postEvent('Tour.filterChallenges', array(&$challenges));
return $challenges;
}
}