PluginProbe
Stream – Activity Log & Audit Trail / 3.4.2
Stream – Activity Log & Audit Trail v3.4.2
4.4.0 4.3.0 4.2.2 4.2.1 trunk 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1 3.1.1 3.10.0 3.2.0 3.2.1 3.2.2 3.2.3 All 50 releases
← All changes | classes/class-plugin.php +20 -43 3.10.03.4.2 View file →
@@ -1,16 +1,7 @@
1 1 <?php
2 -/**
3 - * Initializes plugin
4 - *
5 - * @package WP_Stream;
6 - */
7 -
8 2 namespace WP_Stream;
9 3
10 -/**
11 - * Class Plugin
12 - */
13 4 class Plugin {
14 5 /**
15 6 * Plugin version number.
16 7 *
@@ -17,9 +8,9 @@
17 8 * TODO Maybe pass this as a constructor dependency?
18 9 *
19 10 * @const string
20 11 */
21 - const VERSION = '3.10.0';
12 + const VERSION = '3.4.2';
22 13
23 14 /**
24 15 * WP-CLI command
25 16 *
@@ -27,59 +18,43 @@
27 18 */
28 19 const WP_CLI_COMMAND = 'stream';
29 20
30 21 /**
31 - * Holds and manages WordPress Admin configurations.
32 - *
33 22 * @var Admin
34 23 */
35 24 public $admin;
36 25
37 26 /**
38 - * Holds and manages alerts.
39 - *
40 27 * @var Alerts
41 28 */
42 29 public $alerts;
43 30
44 31 /**
45 - * Holds and manages alerts lists.
46 - *
47 32 * @var Alerts_List
48 33 */
49 34 public $alerts_list;
50 35
51 36 /**
52 - * Holds and manages connectors
53 - *
54 37 * @var Connectors
55 38 */
56 39 public $connectors;
57 40
58 41 /**
59 - * Holds and manages DB connections.
60 - *
61 42 * @var DB
62 43 */
63 44 public $db;
64 45
65 46 /**
66 - * Holds and manages records.
67 - *
68 47 * @var Log
69 48 */
70 49 public $log;
71 50
72 51 /**
73 - * Stores and manages WordPress settings.
74 - *
75 52 * @var Settings
76 53 */
77 54 public $settings;
78 55
79 56 /**
80 - * Process DB migrations.
81 - *
82 57 * @var Install
83 58 */
84 59 public $install;
85 60
@@ -105,12 +80,12 @@
105 80 );
106 81
107 82 spl_autoload_register( array( $this, 'autoload' ) );
108 83
109 - // Load helper functions.
84 + // Load helper functions
110 85 require_once $this->locations['inc_dir'] . 'functions.php';
111 86
112 - // Load DB helper interface/class.
87 + // Load DB helper interface/class
113 88 $driver_class = apply_filters( 'wp_stream_db_driver', '\WP_Stream\DB_Driver_WPDB' );
114 89 $driver = null;
115 90
116 91 if ( class_exists( $driver_class ) ) {
@@ -131,24 +106,24 @@
131 106 esc_html__( 'Stream DB Error', 'stream' )
132 107 );
133 108 }
134 109
135 - // Load languages.
110 + // Load languages
136 111 add_action( 'plugins_loaded', array( $this, 'i18n' ) );
137 112
138 - // Load logger class.
113 + // Load logger class
139 114 $this->log = apply_filters( 'wp_stream_log_handler', new Log( $this ) );
140 115
141 - // Load settings and connectors after widgets_init and before the default init priority.
116 + // Load settings and connectors after widgets_init and before the default init priority
142 117 add_action( 'init', array( $this, 'init' ), 9 );
143 118
144 - // Add frontend indicator.
119 + // Add frontend indicator
145 120 add_action( 'wp_head', array( $this, 'frontend_indicator' ) );
146 121
147 - // Change DB driver after plugin loaded if any add-ons want to replace.
122 + // Change DB driver after plugin loaded if any add-ons want to replace
148 123 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 20 );
149 124
150 - // Load admin area classes.
125 + // Load admin area classes
151 126 if ( is_admin() || ( defined( 'WP_STREAM_DEV_DEBUG' ) && WP_STREAM_DEV_DEBUG ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
152 127 $this->admin = new Admin( $this );
153 128 $this->install = $driver->setup_storage( $this );
154 129 } elseif ( defined( 'DOING_CRON' ) && DOING_CRON ) {
@@ -154,9 +129,9 @@
154 129 } elseif ( defined( 'DOING_CRON' ) && DOING_CRON ) {
155 130 $this->admin = new Admin( $this, $driver );
156 131 }
157 132
158 - // Load WP-CLI command.
133 + // Load WP-CLI command
159 134 if ( defined( 'WP_CLI' ) && WP_CLI ) {
160 135 \WP_CLI::add_command( self::WP_CLI_COMMAND, 'WP_Stream\CLI' );
161 136 }
162 137 }
@@ -163,9 +138,9 @@
163 138
164 139 /**
165 140 * Autoloader for classes
166 141 *
167 - * @param string $class Fully qualified classname to be loaded.
142 + * @param string $class
168 143 */
169 144 public function autoload( $class ) {
170 145 if ( ! preg_match( '/^(?P<namespace>.+)\\\\(?P<autoload>[^\\\\]+)$/', $class, $matches ) ) {
171 146 return;
@@ -198,9 +173,9 @@
198 173 public function i18n() {
199 174 load_plugin_textdomain( 'stream', false, dirname( $this->locations['plugin'] ) . '/languages/' );
200 175 }
201 176
202 - /**
177 + /*
203 178 * Load Settings, Notifications, and Connectors
204 179 *
205 180 * @action init
206 181 */
@@ -220,10 +195,9 @@
220 195 *
221 196 * @return string|void An HTML comment, or nothing if the value is filtered out.
222 197 */
223 198 public function frontend_indicator() {
224 - /* translators: Localization not needed */
225 - $comment = sprintf( 'Stream WordPress user activity plugin v%s', esc_html( $this->get_version() ) );
199 + $comment = sprintf( 'Stream WordPress user activity plugin v%s', esc_html( $this->get_version() ) ); // Localization not needed
226 200
227 201 /**
228 202 * Filter allows the HTML output of the frontend indicator comment
229 203 * to be altered or removed, if desired.
@@ -232,9 +206,9 @@
232 206 */
233 207 $comment = apply_filters( 'wp_stream_frontend_indicator', $comment );
234 208
235 209 if ( ! empty( $comment ) ) {
236 - echo sprintf( "<!-- %s -->\n", esc_html( $comment ) ); // xss ok.
210 + echo sprintf( "<!-- %s -->\n", esc_html( $comment ) ); // xss ok
237 211 }
238 212 }
239 213
240 214 /**
@@ -240,8 +214,10 @@
240 214 /**
241 215 * Version of plugin_dir_url() which works for plugins installed in the plugins directory,
242 216 * and for plugins bundled with themes.
243 217 *
218 + * @throws \Exception
219 + *
244 220 * @return array
245 221 */
246 222 private function locate_plugin() {
247 223 $dir_url = trailingslashit( plugins_url( '', dirname( __FILE__ ) ) );
@@ -264,9 +240,9 @@
264 240 /**
265 241 * Change plugin database driver in case driver plugin loaded after stream
266 242 */
267 243 public function plugins_loaded() {
268 - // Load DB helper interface/class.
244 + // Load DB helper interface/class
269 245 $driver_class = apply_filters( 'wp_stream_db_driver', '\WP_Stream\DB_Driver_WPDB' );
270 246
271 247 if ( class_exists( $driver_class ) ) {
272 248 $driver = new $driver_class();
@@ -294,10 +270,10 @@
294 270
295 271 /**
296 272 * Filter allows the network activated detection to be overridden.
297 273 *
298 - * @param string $is_network_activated Whether the plugin is network activated.
299 - * @param WP_Stream\Plugin $plugin The stream plugin object.
274 + * @param string $is_network_activated Whether the plugin is network activated
275 + * @param WP_Stream\Plugin $plugin The stream plugin object
300 276 */
301 277 return apply_filters( 'wp_stream_is_network_activated', $is_network_activated, $this );
302 278 }
303 279
@@ -306,8 +282,9 @@
306 282 *
307 283 * @return bool
308 284 */
309 285 public function is_mustuse() {
286 +
310 287 $stream_php = trailingslashit( WPMU_PLUGIN_DIR ) . $this->locations['plugin'];
311 288
312 289 if ( file_exists( $stream_php ) && class_exists( 'WP_Stream\Plugin' ) ) {
313 290 return true;