PluginProbe
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity / 1.2.0
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity v1.2.0
3.3.8 trunk 1.0 1.1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.2.0 1.20.0 1.20.1 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 1.6.1 All 66 releases
logtivity / logtivity.php

logtivity.php in Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity 1.2.0, at logtivity.php

130 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Logtivity
5 * Plugin URI: https://logtivity.io
6 * Description: Dedicated Event Monitoring for WordPress using Logtivity.io.
7 * Version: 1.2.0
8 * Author: Logtivity
9 */
10
11 class Logtivity
12 {
13 /**
14 * List all classes here with their file paths. Keep class names the same as filenames.
15 *
16 * @var array
17 */
18 private $dependancies = [
19 'Helpers/Helpers',
20 'Helpers/Logtivity_Wp_User',
21 'Admin/Logtivity_Options',
22 'Admin/Logtivity_Admin',
23 'Services/Logtivity_Log_API',
24 'Services/Logtivity_Logger',
25 'Helpers/Logtivity_Log_Global_Function',
26 'Logs/Logtivity_Abstract_Logger',
27 ];
28
29 /**
30 *
31 * Log classes
32 *
33 */
34 private $logClasses = [
35 'Logs/Core/Logtivity_Post',
36 'Logs/Core/Logtivity_User',
37 'Logs/Core/Logtivity_Core',
38 'Logs/Core/Logtivity_Theme',
39 'Logs/Core/Logtivity_Plugin',
40 ];
41
42 /**
43 * List all integration dependancies
44 *
45 * @var array
46 */
47 private $integrationDependancies = [
48 'WP_DLM' => [
49 'Logs/Download_Monitor/Logtivity_Download_Monitor',
50 ],
51 'MeprCtrlFactory' => [
52 'Logs/Memberpress/Logtivity_Memberpress',
53 ]
54 ];
55
56 public function __construct()
57 {
58 $this->loadDependancies();
59
60 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), [$this, 'addSettingsLinkFromPluginsPage'] );
61 }
62
63 public static function log($action = null, $meta = null, $user_id = null)
64 {
65 return Logtivity_Logger::log($action, $meta, $user_id);
66 }
67
68 public function loadDependancies()
69 {
70 foreach ($this->dependancies as $filePath)
71 {
72 $this->loadFile($filePath);
73 }
74
75 $this->maybeLoadLogClasses();
76
77 $this->loadIntegrationDependancies();
78 }
79
80 public function maybeLoadLogClasses()
81 {
82 if ($this->defaultLoggingDisabled()) {
83 return;
84 }
85
86 foreach ($this->logClasses as $filePath)
87 {
88 $this->loadFile($filePath);
89 }
90 }
91
92 /**
93 * Is the default Event logging from within the plugin enabled
94 *
95 * @return bool
96 */
97 public function defaultLoggingDisabled()
98 {
99 return (new Logtivity_Options)->getOption('logtivity_disable_default_logging');
100 }
101
102 public function loadIntegrationDependancies()
103 {
104 foreach ($this->integrationDependancies as $key => $value)
105 {
106 if (class_exists($key)) {
107 foreach ($value as $filePath)
108 {
109 $this->loadFile($filePath);
110 }
111 }
112 }
113 }
114
115 public function loadFile($filePath)
116 {
117 require_once plugin_dir_path( __FILE__ ) . $filePath .'.php';
118 }
119
120 public function addSettingsLinkFromPluginsPage($links)
121 {
122 $settings_links = array(
123 '<a href="' . admin_url( 'tools.php?page=logtivity' ) . '">Settings</a>',
124 );
125
126 return array_merge($settings_links, $links);
127 }
128 }
129
130 $logtivity = new Logtivity;