PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / classes / WpMatomo / Bootstrap.php
matomo / classes / WpMatomo Last commit date
Admin 5 years ago Commands 6 years ago Db 6 years ago Ecommerce 6 years ago Report 6 years ago Site 5 years ago TrackingCode 5 years ago User 5 years ago views 6 years ago API.php 5 years ago Access.php 6 years ago AjaxTracker.php 5 years ago Annotations.php 6 years ago Bootstrap.php 6 years ago Capabilities.php 6 years ago Compatibility.php 6 years ago Email.php 5 years ago Installer.php 6 years ago Logger.php 5 years ago OptOut.php 5 years ago Paths.php 6 years ago PrivacyBadge.php 6 years ago Referral.php 6 years ago Roles.php 6 years ago ScheduledTasks.php 6 years ago Settings.php 5 years ago Site.php 6 years ago TrackingCode.php 5 years ago Uninstaller.php 6 years ago Updater.php 6 years ago User.php 6 years ago
Bootstrap.php
107 lines
1 <?php
2 /**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 * @package matomo
8 */
9
10 namespace WpMatomo;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // if accessed directly
14 }
15
16 class Bootstrap {
17 /**
18 * Tests only
19 *
20 * @var bool|null
21 */
22 private static $assume_not_bootstrapped;
23
24 private static $bootstrapped_by_wordpress = false;
25
26 /**
27 * Tests only
28 *
29 * @internal
30 * @ignore
31 */
32 public static function set_not_bootstrapped() {
33 self::$assume_not_bootstrapped = true;
34 self::$bootstrapped_by_wordpress = false;
35 }
36
37 public static function was_bootstrapped_by_wordpress() {
38 return self::$bootstrapped_by_wordpress;
39 }
40
41 public function bootstrap() {
42 if ( self::is_bootstrapped() ) {
43 return;
44 }
45
46 self::$bootstrapped_by_wordpress = true;
47 self::$assume_not_bootstrapped = false; // we need to unset it again to prevent recursion
48
49 if ( ! defined( 'PIWIK_ENABLE_DISPATCH' ) ) {
50 define( 'PIWIK_ENABLE_DISPATCH', false );
51 }
52
53 // prevent session related errors during install making it more stable
54 if ( ! defined( 'PIWIK_ENABLE_SESSION_START' ) ) {
55 define( 'PIWIK_ENABLE_SESSION_START', false );
56 }
57
58 if ( ! defined( 'PIWIK_DOCUMENT_ROOT' ) ) {
59 define( 'PIWIK_DOCUMENT_ROOT', plugin_dir_path( MATOMO_ANALYTICS_FILE ) . 'app' );
60 }
61
62 require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
63
64 if ( ! defined( 'PIWIK_INCLUDE_PATH' ) ) {
65 define( 'PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT );
66 }
67
68 require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php';
69 // we need to install now
70
71 include_once 'Db/WordPress.php';
72
73 $environment = new \Piwik\Application\Environment( null );
74 $environment->init();
75
76 \Piwik\FrontController::unsetInstance();
77 $controller = \Piwik\FrontController::getInstance();
78 $controller->init();
79
80 add_action(
81 'set_current_user',
82 function () {
83 $access = \Piwik\Access::getInstance();
84 if ( $access ) {
85 $access->reloadAccess();
86 }
87 }
88 );
89 }
90
91 public static function is_bootstrapped() {
92 if ( true === self::$assume_not_bootstrapped ) {
93 return false;
94 }
95
96 return defined( 'PIWIK_DOCUMENT_ROOT' );
97 }
98
99 /**
100 * @api
101 */
102 public static function do_bootstrap() {
103 $bootstrap = new Bootstrap();
104 $bootstrap->bootstrap();
105 }
106 }
107