Version Description
August 31, 2021 =
Fix: PHP 8.0 compatibility #1272, props @cjhaas.
Development: Update development dependencies and introduce PHPCompatibility checker as part of the automated checks.
Download this release
Release Info
Developer | kasparsd |
Plugin | Stream |
Version | 3.8.0 |
Comparing to | |
See all releases |
Code changes from version 3.7.0 to 3.8.0
- alerts/class-alert-trigger-action.php +3 -3
- alerts/class-alert-trigger-author.php +3 -3
- alerts/class-alert-trigger-context.php +3 -3
- classes/class-alert-trigger.php +3 -3
- classes/class-db-driver-wpdb.php +5 -2
- classes/class-db.php +45 -13
- classes/class-plugin.php +1 -1
- composer.json +7 -6
- connectors/class-connector-settings.php +1 -1
- readme.txt +7 -2
- stream.php +1 -1
alerts/class-alert-trigger-action.php
CHANGED
@@ -164,12 +164,12 @@ class Alert_Trigger_Action extends Alert_Trigger {
|
|
164 |
*
|
165 |
* @see Alert_Trigger::get_display_value().
|
166 |
*
|
167 |
-
* @param string
|
168 |
-
* @param Alert
|
169 |
*
|
170 |
* @return string
|
171 |
*/
|
172 |
-
public function get_display_value( $context = 'normal', $alert ) {
|
173 |
$action = ( ! empty( $alert->alert_meta['trigger_action'] ) ) ? $alert->alert_meta['trigger_action'] : null;
|
174 |
|
175 |
if ( 'post_title' === $context ) {
|
164 |
*
|
165 |
* @see Alert_Trigger::get_display_value().
|
166 |
*
|
167 |
+
* @param string $context The location this data will be displayed in.
|
168 |
+
* @param Alert|null $alert Alert being processed.
|
169 |
*
|
170 |
* @return string
|
171 |
*/
|
172 |
+
public function get_display_value( $context = 'normal', $alert = null ) {
|
173 |
$action = ( ! empty( $alert->alert_meta['trigger_action'] ) ) ? $alert->alert_meta['trigger_action'] : null;
|
174 |
|
175 |
if ( 'post_title' === $context ) {
|
alerts/class-alert-trigger-author.php
CHANGED
@@ -153,12 +153,12 @@ class Alert_Trigger_Author extends Alert_Trigger {
|
|
153 |
*
|
154 |
* @see Alert_Trigger::get_display_value().
|
155 |
*
|
156 |
-
* @param string
|
157 |
-
* @param Alert
|
158 |
*
|
159 |
* @return string
|
160 |
*/
|
161 |
-
public function get_display_value( $context = 'normal', $alert ) {
|
162 |
$author = ( ! empty( $alert->alert_meta['trigger_author'] ) ) ? $alert->alert_meta['trigger_author'] : null;
|
163 |
if ( empty( $author ) ) {
|
164 |
$author = __( 'Any User', 'stream' );
|
153 |
*
|
154 |
* @see Alert_Trigger::get_display_value().
|
155 |
*
|
156 |
+
* @param string $context The location this data will be displayed in.
|
157 |
+
* @param Alert|null $alert Alert being processed.
|
158 |
*
|
159 |
* @return string
|
160 |
*/
|
161 |
+
public function get_display_value( $context = 'normal', $alert = null ) {
|
162 |
$author = ( ! empty( $alert->alert_meta['trigger_author'] ) ) ? $alert->alert_meta['trigger_author'] : null;
|
163 |
if ( empty( $author ) ) {
|
164 |
$author = __( 'Any User', 'stream' );
|
alerts/class-alert-trigger-context.php
CHANGED
@@ -202,12 +202,12 @@ class Alert_Trigger_Context extends Alert_Trigger {
|
|
202 |
*
|
203 |
* @see Alert_Trigger::get_display_value().
|
204 |
*
|
205 |
-
* @param string
|
206 |
-
* @param Alert
|
207 |
*
|
208 |
* @return string
|
209 |
*/
|
210 |
-
public function get_display_value( $context = 'normal', $alert ) {
|
211 |
$context = ( ! empty( $alert->alert_meta['trigger_context'] ) ) ? $alert->alert_meta['trigger_context'] : null;
|
212 |
$connector = ( ! empty( $alert->alert_meta['trigger_connector'] ) ) ? $alert->alert_meta['trigger_connector'] : null;
|
213 |
if ( empty( $context ) && empty( $connector ) ) {
|
202 |
*
|
203 |
* @see Alert_Trigger::get_display_value().
|
204 |
*
|
205 |
+
* @param string $context The location this data will be displayed in.
|
206 |
+
* @param Alert|null $alert Alert being processed.
|
207 |
*
|
208 |
* @return string
|
209 |
*/
|
210 |
+
public function get_display_value( $context = 'normal', $alert = null ) {
|
211 |
$context = ( ! empty( $alert->alert_meta['trigger_context'] ) ) ? $alert->alert_meta['trigger_context'] : null;
|
212 |
$connector = ( ! empty( $alert->alert_meta['trigger_connector'] ) ) ? $alert->alert_meta['trigger_connector'] : null;
|
213 |
if ( empty( $context ) && empty( $connector ) ) {
|
classes/class-alert-trigger.php
CHANGED
@@ -78,11 +78,11 @@ abstract class Alert_Trigger {
|
|
78 |
/**
|
79 |
* Returns the trigger's value for the given alert.
|
80 |
*
|
81 |
-
* @param string
|
82 |
-
* @param Alert
|
83 |
* @return string
|
84 |
*/
|
85 |
-
abstract public function get_display_value( $context = 'normal', $alert );
|
86 |
|
87 |
/**
|
88 |
* Allow connectors to determine if their dependencies is satisfied or not
|
78 |
/**
|
79 |
* Returns the trigger's value for the given alert.
|
80 |
*
|
81 |
+
* @param string $context The location this data will be displayed in.
|
82 |
+
* @param Alert|null $alert Alert being processed.
|
83 |
* @return string
|
84 |
*/
|
85 |
+
abstract public function get_display_value( $context = 'normal', $alert = null );
|
86 |
|
87 |
/**
|
88 |
* Allow connectors to determine if their dependencies is satisfied or not
|
classes/class-db-driver-wpdb.php
CHANGED
@@ -65,8 +65,11 @@ class DB_Driver_WPDB implements DB_Driver {
|
|
65 |
return false;
|
66 |
}
|
67 |
|
68 |
-
$meta =
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
$result = $wpdb->insert( $this->table, $data );
|
72 |
if ( ! $result ) {
|
65 |
return false;
|
66 |
}
|
67 |
|
68 |
+
$meta = array();
|
69 |
+
if ( array_key_exists( 'meta', $data ) ) {
|
70 |
+
$meta = $data['meta'];
|
71 |
+
unset( $data['meta'] );
|
72 |
+
}
|
73 |
|
74 |
$result = $wpdb->insert( $this->table, $data );
|
75 |
if ( ! $result ) {
|
classes/class-db.php
CHANGED
@@ -55,22 +55,11 @@ class DB {
|
|
55 |
*/
|
56 |
$record = apply_filters( 'wp_stream_record_array', $record );
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
function( &$value, &$key ) {
|
61 |
-
if ( ! is_array( $value ) ) {
|
62 |
-
$value = wp_strip_all_tags( $value );
|
63 |
-
}
|
64 |
-
}
|
65 |
-
);
|
66 |
-
|
67 |
-
if ( empty( $record ) ) {
|
68 |
return false;
|
69 |
}
|
70 |
|
71 |
-
$fields = array( 'object_id', 'site_id', 'blog_id', 'user_id', 'user_role', 'created', 'summary', 'ip', 'connector', 'context', 'action', 'meta' );
|
72 |
-
$data = array_intersect_key( $record, array_flip( $fields ) );
|
73 |
-
|
74 |
$record_id = $this->driver->insert_record( $data );
|
75 |
|
76 |
if ( ! $record_id ) {
|
@@ -96,6 +85,49 @@ class DB {
|
|
96 |
return absint( $record_id );
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
/**
|
100 |
* Returns array of existing values for requested column.
|
101 |
* Used to fill search filters with only used items, instead of all items.
|
55 |
*/
|
56 |
$record = apply_filters( 'wp_stream_record_array', $record );
|
57 |
|
58 |
+
$data = $this->sanitize_record( $record );
|
59 |
+
if ( empty( $data ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
return false;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
63 |
$record_id = $this->driver->insert_record( $data );
|
64 |
|
65 |
if ( ! $record_id ) {
|
85 |
return absint( $record_id );
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* Ensure the record matches our schema.
|
90 |
+
*
|
91 |
+
* @param array $record Record to store.
|
92 |
+
*
|
93 |
+
* @return array
|
94 |
+
*/
|
95 |
+
protected function sanitize_record( $record ) {
|
96 |
+
if ( ! is_array( $record ) ) {
|
97 |
+
return array();
|
98 |
+
}
|
99 |
+
|
100 |
+
$record_defaults = array(
|
101 |
+
'object_id' => null,
|
102 |
+
'site_id' => null,
|
103 |
+
'blog_id' => null,
|
104 |
+
'user_id' => null,
|
105 |
+
'user_role' => null,
|
106 |
+
'created' => null,
|
107 |
+
'summary' => null,
|
108 |
+
'ip' => null,
|
109 |
+
'connector' => null,
|
110 |
+
'context' => null,
|
111 |
+
'action' => null,
|
112 |
+
'meta' => array(),
|
113 |
+
);
|
114 |
+
|
115 |
+
// Records can have only these fields.
|
116 |
+
$record = array_intersect_key( $record, $record_defaults );
|
117 |
+
|
118 |
+
// Sanitize all record values.
|
119 |
+
return array_map(
|
120 |
+
function( $value ) {
|
121 |
+
if ( ! is_array( $value ) ) {
|
122 |
+
return wp_strip_all_tags( $value );
|
123 |
+
}
|
124 |
+
|
125 |
+
return $value;
|
126 |
+
},
|
127 |
+
$record
|
128 |
+
);
|
129 |
+
}
|
130 |
+
|
131 |
/**
|
132 |
* Returns array of existing values for requested column.
|
133 |
* Used to fill search filters with only used items, instead of all items.
|
classes/class-plugin.php
CHANGED
@@ -18,7 +18,7 @@ class Plugin {
|
|
18 |
*
|
19 |
* @const string
|
20 |
*/
|
21 |
-
const VERSION = '3.
|
22 |
|
23 |
/**
|
24 |
* WP-CLI command
|
18 |
*
|
19 |
* @const string
|
20 |
*/
|
21 |
+
const VERSION = '3.8.0';
|
22 |
|
23 |
/**
|
24 |
* WP-CLI command
|
composer.json
CHANGED
@@ -16,16 +16,17 @@
|
|
16 |
"require-dev": {
|
17 |
"automattic/vipwpcs": "^2.0.0",
|
18 |
"humanmade/mercator": "^1.0",
|
19 |
-
"johnpbloch/wordpress": "^5.
|
20 |
"php-coveralls/php-coveralls": "^2.1",
|
|
|
21 |
"phpunit/phpunit": "^5.7",
|
22 |
-
"wp-cli/wp-cli-bundle": "^2.
|
23 |
-
"wp-coding-standards/wpcs": "^2.
|
24 |
"wp-phpunit/wp-phpunit": "^5.4",
|
25 |
"wpackagist-plugin/advanced-custom-fields": "5.8.12",
|
26 |
-
"wpackagist-plugin/easy-digital-downloads": "
|
27 |
-
"wpackagist-plugin/jetpack": "
|
28 |
-
"wpackagist-plugin/user-switching": "
|
29 |
"wpsh/local": "^0.2.3"
|
30 |
},
|
31 |
"config": {
|
16 |
"require-dev": {
|
17 |
"automattic/vipwpcs": "^2.0.0",
|
18 |
"humanmade/mercator": "^1.0",
|
19 |
+
"johnpbloch/wordpress": "^5.8",
|
20 |
"php-coveralls/php-coveralls": "^2.1",
|
21 |
+
"phpcompatibility/php-compatibility": "^9.3",
|
22 |
"phpunit/phpunit": "^5.7",
|
23 |
+
"wp-cli/wp-cli-bundle": "^2.5",
|
24 |
+
"wp-coding-standards/wpcs": "^2.3",
|
25 |
"wp-phpunit/wp-phpunit": "^5.4",
|
26 |
"wpackagist-plugin/advanced-custom-fields": "5.8.12",
|
27 |
+
"wpackagist-plugin/easy-digital-downloads": "2.9.23",
|
28 |
+
"wpackagist-plugin/jetpack": "10.0",
|
29 |
+
"wpackagist-plugin/user-switching": "1.5.5",
|
30 |
"wpsh/local": "^0.2.3"
|
31 |
},
|
32 |
"config": {
|
connectors/class-connector-settings.php
CHANGED
@@ -135,7 +135,7 @@ class Connector_Settings extends Connector {
|
|
135 |
'show_on_front' => esc_html__( 'Front page displays', 'stream' ),
|
136 |
'page_on_front' => esc_html__( 'Front page displays', 'stream' ),
|
137 |
'page_for_posts' => esc_html__( 'Front page displays', 'stream' ),
|
138 |
-
'posts_per_page' => esc_html__( 'Blog pages show at most', 'stream' ),
|
139 |
'posts_per_rss' => esc_html__( 'Syndication feeds show the most recent', 'stream' ),
|
140 |
'rss_use_excerpt' => esc_html__( 'For each article in a feed, show', 'stream' ),
|
141 |
'blog_public' => esc_html__( 'Search Engine Visibility', 'stream' ),
|
135 |
'show_on_front' => esc_html__( 'Front page displays', 'stream' ),
|
136 |
'page_on_front' => esc_html__( 'Front page displays', 'stream' ),
|
137 |
'page_for_posts' => esc_html__( 'Front page displays', 'stream' ),
|
138 |
+
'posts_per_page' => esc_html__( 'Blog pages show at most', 'stream' ), // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page, because this is not a query.
|
139 |
'posts_per_rss' => esc_html__( 'Syndication feeds show the most recent', 'stream' ),
|
140 |
'rss_use_excerpt' => esc_html__( 'For each article in a feed, show', 'stream' ),
|
141 |
'blog_public' => esc_html__( 'Search Engine Visibility', 'stream' ),
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: xwp
|
3 |
Tags: wp stream, stream, activity, logs, track
|
4 |
Requires at least: 4.5
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -91,6 +91,11 @@ Past Contributors: fjarrett, shadyvb, chacha, westonruter, johnregan3, jacobschw
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
94 |
= 3.7.0 - May 11, 2021 =
|
95 |
|
96 |
- Fix: Exclude records when all conditions match instead of just one [#1242](https://github.com/xwp/stream/pull/1242), props [@kidunot89](https://github.com/kidunot89) and [@esausaravia](https://github.com/esausaravia)
|
2 |
Contributors: xwp
|
3 |
Tags: wp stream, stream, activity, logs, track
|
4 |
Requires at least: 4.5
|
5 |
+
Tested up to: 5.8
|
6 |
+
Stable tag: 3.8.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 3.8.0 - August 31, 2021 =
|
95 |
+
|
96 |
+
- Fix: PHP 8.0 compatibility [#1272](https://github.com/xwp/stream/issues/1272), props [@cjhaas](https://github.com/cjhaas).
|
97 |
+
- Development: Update development dependencies and introduce [PHPCompatibility checker](https://github.com/PHPCompatibility/PHPCompatibility) as part of the automated checks.
|
98 |
+
|
99 |
= 3.7.0 - May 11, 2021 =
|
100 |
|
101 |
- Fix: Exclude records when all conditions match instead of just one [#1242](https://github.com/xwp/stream/pull/1242), props [@kidunot89](https://github.com/kidunot89) and [@esausaravia](https://github.com/esausaravia)
|
stream.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Stream
|
4 |
* Plugin URI: https://xwp.co/work/stream/
|
5 |
* Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress 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.
|
6 |
-
* Version: 3.
|
7 |
* Author: XWP
|
8 |
* Author URI: https://xwp.co
|
9 |
* License: GPLv2+
|
3 |
* Plugin Name: Stream
|
4 |
* Plugin URI: https://xwp.co/work/stream/
|
5 |
* Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress 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.
|
6 |
+
* Version: 3.8.0
|
7 |
* Author: XWP
|
8 |
* Author URI: https://xwp.co
|
9 |
* License: GPLv2+
|