Skip to content

Commit ec96a02

Browse files
author
Kaspars Dambis
authored
Merge pull request xwp#1460 from xwp/release/3.10.0
Release version 3.10.0
2 parents 905683d + d3a1534 commit ec96a02

28 files changed

+3072
-2769
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint and Test
2+
3+
on: push
4+
5+
jobs:
6+
7+
lint:
8+
name: Lint and Test
9+
runs-on: ubuntu-22.04
10+
steps:
11+
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Setup Node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version-file: '.nvmrc'
19+
cache: 'npm'
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.1'
25+
tools: composer:v2
26+
27+
- name: Install NPM dependencies
28+
run: npm install
29+
30+
- name: Install Composer dependencies
31+
run: composer install
32+
33+
- name: Lint
34+
run: npm run lint
35+
36+
- name: Pull Docker Images
37+
run: docker-compose pull wordpress
38+
39+
- name: Test PHP
40+
run: npm run phpunit
41+
42+
- name: Build
43+
run: npm run build

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ before_install:
7979

8080
install:
8181
- npm install
82+
- composer install
8283

8384
script:
8485
- npm run lint

alerts/class-alert-type-menu-alert.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ public function menu_alert( $wp_admin_bar ) {
141141
/**
142142
* Get a list of all current alert messages for current user.
143143
*
144-
* @todo update this for VIP. (get_user_meta)
145-
*
146144
* @return array List of alert messages
147145
*/
148146
public function get_messages() {

alerts/class-alert-type-slack.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public function alert( $record_id, $recordarr, $alert ) {
142142
'author_icon' => get_avatar_url( $user_id, 16 ),
143143
'author_link' => admin_url( "admin.php?page=wp_stream&user_id=$user_id" ),
144144
'author_name' => trim( "$user->first_name $user->last_name" ),
145-
'fallback' => html_entity_decode( $recordarr['summary'] ),
145+
'fallback' => html_entity_decode( $recordarr['summary'], ENT_COMPAT ),
146146
'fields' => $fields,
147147
'footer' => get_bloginfo( 'name' ),
148148
'footer_icon' => get_site_icon_url( 16, $logo[0], $recordarr['blog_id'] ),
149-
'title' => html_entity_decode( $recordarr['summary'] ),
149+
'title' => html_entity_decode( $recordarr['summary'], ENT_COMPAT ),
150150
'ts' => strtotime( $recordarr['created'] ),
151151
);
152152
if ( array_key_exists( 'object_id', $recordarr ) ) {

classes/class-admin.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,17 @@ public function admin_enqueue_scripts( $hook ) {
532532
* @return bool
533533
*/
534534
public function is_stream_screen() {
535-
if ( is_admin() && false !== strpos( wp_stream_filter_input( INPUT_GET, 'page' ), $this->records_page_slug ) ) {
535+
if ( ! is_admin() ) {
536+
return false;
537+
}
538+
539+
$page = wp_stream_filter_input( INPUT_GET, 'page' );
540+
if ( is_string( $page ) && false !== strpos( $page, $this->records_page_slug ) ) {
536541
return true;
537542
}
538543

539544
$screen = get_current_screen();
540-
if ( is_admin() && Alerts::POST_TYPE === $screen->post_type ) {
545+
if ( Alerts::POST_TYPE === $screen->post_type ) {
541546
return true;
542547
}
543548

@@ -1066,10 +1071,6 @@ public function get_users_record_meta( $authors ) {
10661071
* @return mixed
10671072
*/
10681073
public function get_user_meta( $user_id, $meta_key, $single = true ) {
1069-
if ( wp_stream_is_vip() && function_exists( 'get_user_attribute' ) ) {
1070-
return get_user_attribute( $user_id, $meta_key );
1071-
}
1072-
10731074
return get_user_meta( $user_id, $meta_key, $single );
10741075
}
10751076

@@ -1084,10 +1085,6 @@ public function get_user_meta( $user_id, $meta_key, $single = true ) {
10841085
* @return int|bool
10851086
*/
10861087
public function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {
1087-
if ( wp_stream_is_vip() && function_exists( 'update_user_attribute' ) ) {
1088-
return update_user_attribute( $user_id, $meta_key, $meta_value );
1089-
}
1090-
10911088
return update_user_meta( $user_id, $meta_key, $meta_value, $prev_value );
10921089
}
10931090

@@ -1101,10 +1098,6 @@ public function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value
11011098
* @return bool
11021099
*/
11031100
public function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
1104-
if ( wp_stream_is_vip() && function_exists( 'delete_user_attribute' ) ) {
1105-
return delete_user_attribute( $user_id, $meta_key, $meta_value );
1106-
}
1107-
11081101
return delete_user_meta( $user_id, $meta_key, $meta_value );
11091102
}
11101103
}

classes/class-author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function get_avatar_src( $size = 80 ) {
180180
}
181181

182182
if ( 1 === preg_match( '/src=([\'"])(.*?)\1/', $img, $matches ) ) {
183-
$src = html_entity_decode( $matches[2] );
183+
$src = html_entity_decode( $matches[2], ENT_COMPAT );
184184
} else {
185185
return false;
186186
}

classes/class-filter-input.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ class Filter_Input {
1818
* @var array
1919
*/
2020
public static $filter_callbacks = array(
21-
FILTER_DEFAULT => null,
21+
FILTER_DEFAULT => null,
2222
// Validate.
23-
FILTER_VALIDATE_BOOLEAN => 'is_bool',
24-
FILTER_VALIDATE_EMAIL => 'is_email',
25-
FILTER_VALIDATE_FLOAT => 'is_float',
26-
FILTER_VALIDATE_INT => 'is_int',
27-
FILTER_VALIDATE_IP => array( __CLASS__, 'is_ip_address' ),
28-
FILTER_VALIDATE_REGEXP => array( __CLASS__, 'is_regex' ),
29-
FILTER_VALIDATE_URL => 'wp_http_validate_url',
23+
FILTER_VALIDATE_BOOLEAN => 'is_bool',
24+
FILTER_VALIDATE_EMAIL => 'is_email',
25+
FILTER_VALIDATE_FLOAT => 'is_float',
26+
FILTER_VALIDATE_INT => 'is_int',
27+
FILTER_VALIDATE_IP => array( __CLASS__, 'is_ip_address' ),
28+
FILTER_VALIDATE_REGEXP => array( __CLASS__, 'is_regex' ),
29+
FILTER_VALIDATE_URL => 'wp_http_validate_url',
3030
// Sanitize.
31-
FILTER_SANITIZE_EMAIL => 'sanitize_email',
32-
FILTER_SANITIZE_ENCODED => 'esc_url_raw',
33-
FILTER_SANITIZE_NUMBER_FLOAT => 'floatval',
34-
FILTER_SANITIZE_NUMBER_INT => 'intval',
35-
FILTER_SANITIZE_SPECIAL_CHARS => 'htmlspecialchars',
36-
FILTER_SANITIZE_STRING => 'sanitize_text_field',
37-
FILTER_SANITIZE_URL => 'esc_url_raw',
31+
FILTER_SANITIZE_EMAIL => 'sanitize_email',
32+
FILTER_SANITIZE_ENCODED => 'esc_url_raw',
33+
FILTER_SANITIZE_NUMBER_FLOAT => 'floatval',
34+
FILTER_SANITIZE_NUMBER_INT => 'intval',
35+
FILTER_SANITIZE_SPECIAL_CHARS => 'htmlspecialchars',
36+
FILTER_SANITIZE_FULL_SPECIAL_CHARS => 'sanitize_text_field',
37+
FILTER_SANITIZE_URL => 'esc_url_raw',
3838
// Other.
39-
FILTER_UNSAFE_RAW => null,
39+
FILTER_UNSAFE_RAW => null,
4040
);
4141

4242
/**

classes/class-list-table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ public function get_hidden_columns() {
151151
}
152152

153153
// Directly checking the user meta; to check whether user has changed screen option or not.
154-
$hidden = $this->plugin->admin->get_user_meta( $user->ID, 'manage' . $this->screen->id . 'columnshidden', true );
154+
$hidden = get_user_meta( $user->ID, 'manage' . $this->screen->id . 'columnshidden', true );
155155

156156
// If user meta is not found; add the default hidden column 'id'.
157157
if ( ! $hidden ) {
158158
$hidden = array( 'id' );
159-
$this->plugin->admin->update_user_meta( $user->ID, 'manage' . $this->screen->id . 'columnshidden', $hidden );
159+
update_user_meta( $user->ID, 'manage' . $this->screen->id . 'columnshidden', $hidden );
160160
}
161161

162162
return $hidden;
@@ -1139,7 +1139,7 @@ public function screen_controls( $status, $args ) {
11391139
if ( 'on' === $option && 'false' === $heartbeat ) {
11401140
$option = 'off';
11411141

1142-
$this->plugin->admin->update_user_meta( $user_id, $this->plugin->admin->live_update->user_meta_key, 'off' );
1142+
update_user_meta( $user_id, $this->plugin->admin->live_update->user_meta_key, 'off' );
11431143
}
11441144

11451145
$nonce = wp_create_nonce( $this->plugin->admin->live_update->user_meta_key . '_nonce' );

classes/class-live-update.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function enable_live_update() {
5656
check_ajax_referer( $this->user_meta_key . '_nonce', 'nonce' );
5757

5858
$input = array(
59-
'checked' => FILTER_SANITIZE_STRING,
60-
'user' => FILTER_SANITIZE_STRING,
61-
'heartbeat' => FILTER_SANITIZE_STRING,
59+
'checked' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
60+
'user' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
61+
'heartbeat' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
6262
);
6363

6464
$input = filter_input_array( INPUT_POST, $input );
@@ -72,14 +72,14 @@ public function enable_live_update() {
7272
$user = (int) $input['user'];
7373

7474
if ( 'false' === $input['heartbeat'] ) {
75-
$this->plugin->admin->update_user_meta( $user, $this->user_meta_key, 'off' );
75+
update_user_meta( $user, $this->user_meta_key, 'off' );
7676

7777
wp_send_json_error( esc_html__( "Live updates could not be enabled because Heartbeat is not loaded.\n\nYour hosting provider or another plugin may have disabled it for performance reasons.", 'stream' ) );
7878

7979
return;
8080
}
8181

82-
$success = $this->plugin->admin->update_user_meta( $user, $this->user_meta_key, $checked );
82+
$success = update_user_meta( $user, $this->user_meta_key, $checked );
8383

8484
if ( $success ) {
8585
wp_send_json_success( ( 'on' === $checked ) ? 'Live Updates enabled' : 'Live Updates disabled' );
@@ -183,7 +183,7 @@ public function heartbeat_received( $response, $data ) {
183183
return $response;
184184
}
185185

186-
$enable_stream_update = ( 'off' !== $this->plugin->admin->get_user_meta( get_current_user_id(), $this->user_meta_key ) );
186+
$enable_stream_update = ( 'off' !== get_user_meta( get_current_user_id(), $this->user_meta_key ) );
187187

188188
// Register list table.
189189
$this->list_table = new List_Table(

classes/class-plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Plugin {
1818
*
1919
* @const string
2020
*/
21-
const VERSION = '3.9.3';
21+
const VERSION = '3.10.0';
2222

2323
/**
2424
* WP-CLI command

0 commit comments

Comments
 (0)