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/CustomJsTracker/API.php')
-rw-r--r--plugins/CustomJsTracker/API.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/CustomJsTracker/API.php b/plugins/CustomJsTracker/API.php
new file mode 100644
index 0000000000..c8349efe2e
--- /dev/null
+++ b/plugins/CustomJsTracker/API.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Piwik - 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\CustomJsTracker;
+
+use Piwik\Container\StaticContainer;
+use Piwik\Piwik;
+use Piwik\Plugins\CustomJsTracker\Exception\AccessDeniedException;
+
+/**
+ * API for plugin CustomJsTracker
+ *
+ * @method static \Piwik\Plugins\CustomJsTracker\API getInstance()
+ */
+class API extends \Piwik\Plugin\API
+{
+ /**
+ * Detects whether plugin trackers will be automatically added to piwik.js or not. If not, the plugin tracker files
+ * need to be loaded manually.
+ * @return bool
+ */
+ public function doesIncludePluginTrackersAutomatically()
+ {
+ Piwik::checkUserHasSomeAdminAccess();
+
+ try {
+ $updater = StaticContainer::get('Piwik\Plugins\CustomJsTracker\TrackerUpdater');
+ $updater->checkWillSucceed();
+ return true;
+ } catch (AccessDeniedException $e) {
+ return false;
+ } catch (\Exception $e) {
+ return false;
+ }
+ }
+
+}