PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.10.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.10.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 / PluginInit.php
matomo / classes / WpMatomo Last commit date
Admin 1 month ago Commands 2 years ago Db 1 year ago Ecommerce 1 month ago Report 2 months ago Site 2 months ago TrackingCode 4 months ago Updater 4 years ago User 2 months ago Workarounds 2 years ago WpStatistics 5 months ago views 1 month ago AIBotTracking.php 4 months ago API.php 2 months ago Access.php 4 years ago AjaxTracker.php 4 months ago Annotations.php 2 months ago Bootstrap.php 10 months ago Capabilities.php 2 months ago Compatibility.php 2 months ago Email.php 2 years ago ErrorNotice.php 1 month ago Feature.php 2 months ago Installer.php 1 month ago Logger.php 1 year ago OptOut.php 1 month ago Paths.php 5 months ago PluginActionLinks.php 2 months ago PluginAdminOverrides.php 2 months ago PluginInit.php 2 months ago PrivacyBadge.php 4 years ago RedirectOnActivation.php 2 months ago Referral.php 2 months ago Roles.php 2 months ago ScheduledTasks.php 2 months ago Settings.php 4 months ago Site.php 3 years ago TrackingCode.php 2 months ago Uninstaller.php 5 months ago Updater.php 10 months ago User.php 4 years ago
PluginInit.php
83 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 use WpMatomo\Ecommerce\EasyDigitalDownloads;
13 use WpMatomo\Ecommerce\MemberPress;
14 use WpMatomo\Ecommerce\Woocommerce;
15 use WpMatomo\Site\Sync\SyncConfig;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit; // if accessed directly
19 }
20
21 class PluginInit extends Feature {
22
23 /**
24 * @var Settings
25 */
26 private $settings;
27
28 public function __construct( Settings $settings ) {
29 $this->settings = $settings;
30 }
31
32 public function register_hooks() {
33 add_action( 'init', [ $this, 'init_plugin' ] );
34 }
35
36 public function init_plugin() {
37 if ( ( is_admin() || matomo_is_app_request() ) && ! wp_doing_ajax() ) {
38 $installer = new Installer( $this->settings );
39 $installer->register_hooks();
40 if ( $installer->looks_like_it_is_installed() ) {
41 if ( is_admin() && ( ! defined( 'MATOMO_ENABLE_AUTO_UPGRADE' ) || MATOMO_ENABLE_AUTO_UPGRADE ) ) {
42 $updater = new Updater( $this->settings );
43 $updater->update_if_needed();
44 }
45 } else {
46 if ( matomo_is_app_request() ) {
47 // we can't install if matomo is requested... there's some circular reference
48 wp_safe_redirect( admin_url() );
49 exit;
50 } else {
51 if ( $installer->can_be_installed() ) {
52 $installer->install();
53 }
54 }
55 }
56 }
57
58 // TODO: can this be moved out of here? try in a later release
59 $tracking_code = new TrackingCode( $this->settings );
60 if ( $this->settings->is_tracking_enabled()
61 && $this->settings->get_global_option( 'track_ecommerce' )
62 && ! $tracking_code->is_hidden_user()
63 ) {
64 $tracker = new AjaxTracker( $this->settings );
65
66 $sync_config = new SyncConfig( $this->settings );
67
68 if ( function_exists( 'WC' ) ) {
69 $woocommerce = new Woocommerce( $tracker, $this->settings, $sync_config );
70 $woocommerce->register_hooks();
71 }
72
73 $easy_digital_downloads = new EasyDigitalDownloads( $tracker, $this->settings, $sync_config );
74 $easy_digital_downloads->register_hooks();
75
76 $member_press = new MemberPress( $tracker, $this->settings, $sync_config );
77 $member_press->register_hooks();
78
79 do_action( 'matomo_ecommerce_init', $tracker );
80 }
81 }
82 }
83