Repository navigation
Expand file tree
/
Copy pathstream.php
More file actions
92 lines (82 loc) · 3.26 KB
/
Copy pathstream.php
File metadata and controls
92 lines (82 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Plugin Name: Stream - Activity Log & Audit Trail
* Plugin URI: https://xwp.co/work/stream/
* Description: Stream is an activity log and audit trail for WordPress — track every change made on your site in beautifully organized detail. All activity is organized by context, action and IP address for easy filtering. Developers can extend Stream with custom connectors to log any kind of action.
* Version: 4.4.0
* Requires PHP: 7.4
* Author: XWP
* Author URI: https://xwp.co
* License: GPLv2+
* Text Domain: stream
* Domain Path: /languages
*
* @package WP_Stream
*/
/**
* Copyright (c) 2015 XWP.Co Pty Ltd. (https://xwp.co/)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 or, at
* your discretion, any later version, as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Configuration Constants
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'WP_STREAM_SETTINGS_CAPABILITY' ) ) {
define( 'WP_STREAM_SETTINGS_CAPABILITY', 'manage_options' );
}
if ( ! defined( 'WP_STREAM_MIN_PHP_VERSION' ) ) {
define( 'WP_STREAM_MIN_PHP_VERSION', '7.4' );
}
if ( version_compare( PHP_VERSION, WP_STREAM_MIN_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'wp_stream_fail_php_version' );
add_action( 'network_admin_notices', 'wp_stream_fail_php_version' );
} else {
require __DIR__ . '/classes/class-plugin.php';
$plugin_class_name = 'WP_Stream\Plugin';
if ( class_exists( $plugin_class_name ) ) {
$GLOBALS['wp_stream'] = new $plugin_class_name();
}
}
/**
* Invoked when the PHP version check fails.
*
* Renders an admin notice for users who can activate plugins. Hooked only to
* admin_notices and network_admin_notices so REST, feeds, AJAX, and WP-CLI
* responses are not polluted.
*/
function wp_stream_fail_php_version() {
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
load_plugin_textdomain( 'stream', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
/* translators: %s is the minimum PHP version. */
$message = sprintf( __( 'Stream requires PHP version %s or newer. Plugin is currently NOT ACTIVE.', 'stream' ), WP_STREAM_MIN_PHP_VERSION );
$html_message = sprintf( '<div class="notice notice-error">%s</div>', wpautop( $message ) );
echo wp_kses_post( $html_message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped by wp_kses_post().
}
/**
* Helper for external plugins which wish to use Stream.
*
* Returns null when the plugin global is not set, which avoids an undefined-index
* warning. Callers must check for null before calling a method on the result.
*
* @return WP_Stream\Plugin|null Plugin instance, or null if Stream has not finished constructing.
*/
function wp_stream_get_instance() {
return $GLOBALS['wp_stream'] ?? null;
}