PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.13.0
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.13.0
5.13.0 5.12.1 5.12.0 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 6 days ago Commands 6 days ago Db 6 days ago Ecommerce 1 month ago Report 1 month ago Site 6 days ago TrackingCode 6 days ago Updater 4 years ago User 6 days ago Workarounds 2 years ago WpStatistics 1 month ago views 1 month ago AIBotTracking.php 1 month ago API.php 1 month ago Access.php 6 days ago AjaxTracker.php 6 months ago Annotations.php 1 month ago Bootstrap.php 1 year ago Capabilities.php 6 days ago Compatibility.php 1 month ago Email.php 1 month ago ErrorNotice.php 1 month ago Feature.php 4 months ago Installer.php 1 month ago Logger.php 1 year ago MinimumRequirements.php 6 days ago MinimumRequirementsNotice.php 6 days ago MinimumRequirementsUpdateGuard.php 6 days ago OptOut.php 3 months ago Paths.php 1 month ago PluginActionLinks.php 4 months ago PluginAdminOverrides.php 1 month ago PluginInit.php 1 month ago PrivacyBadge.php 4 years ago RedirectOnActivation.php 4 months ago Referral.php 4 months ago Request.php 6 days ago Roles.php 4 months ago ScheduledTasks.php 1 month ago Settings.php 6 days ago Site.php 6 days ago TrackingCode.php 1 month ago Uninstaller.php 6 days ago Updater.php 1 month ago User.php 6 days ago
PluginInit.php
79 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 } elseif ( matomo_is_app_request() ) {
46 // we can't install if matomo is requested... there's some circular reference
47 wp_safe_redirect( admin_url() );
48 exit;
49 } elseif ( $installer->can_be_installed() ) {
50 $installer->install();
51 }
52 }
53
54 // TODO: can this be moved out of here? try in a later release
55 $tracking_code = new TrackingCode( $this->settings );
56 if ( $this->settings->is_tracking_enabled()
57 && $this->settings->get_global_option( 'track_ecommerce' )
58 && ! $tracking_code->is_hidden_user()
59 ) {
60 $tracker = new AjaxTracker( $this->settings );
61
62 $sync_config = new SyncConfig( $this->settings );
63
64 if ( function_exists( 'WC' ) ) {
65 $woocommerce = new Woocommerce( $tracker, $this->settings, $sync_config );
66 $woocommerce->register_hooks();
67 }
68
69 $easy_digital_downloads = new EasyDigitalDownloads( $tracker, $this->settings, $sync_config );
70 $easy_digital_downloads->register_hooks();
71
72 $member_press = new MemberPress( $tracker, $this->settings, $sync_config );
73 $member_press->register_hooks();
74
75 do_action( 'matomo_ecommerce_init', $tracker );
76 }
77 }
78 }
79