diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-12-02 21:01:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 21:01:01 +0300 |
commit | fb0a8769499fc04dc23ae77c859c249d08b4eb35 (patch) | |
tree | 1e1457855e47c627e2f92cd437aa32c200944339 /core/SettingsServer.php | |
parent | 54dadb98beae46f88203df273d1bada6a2596b5b (diff) |
Add method to detect if we are running within Matomo for WordPress (#15213)
Diffstat (limited to 'core/SettingsServer.php')
-rw-r--r-- | core/SettingsServer.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/SettingsServer.php b/core/SettingsServer.php index 1b35efc8f1..8970e38549 100644 --- a/core/SettingsServer.php +++ b/core/SettingsServer.php @@ -57,6 +57,17 @@ class SettingsServer } /** + * Returns true if Matomo is running within Matomo for WordPress. + * + * @return bool true if Matomo is running in WordPress, false if Matomo is running as part of On-Premise + * @api + */ + public static function isMatomoForWordPress() + { + return defined( 'ABSPATH') && function_exists('\add_action'); + } + + /** * Returns `true` if running on Microsoft IIS 7 (or above), `false` if otherwise. * * @return bool |