Skip to content

Commit 9c44b39

Browse files
Fix PHP-8 Compatibility and Translation (#447)
* fix: Fixed PHP-8 deprecation warning for Singletonable * fix: Fixed translation issue and spacing * fix: Remove __wakeup method as it's not necessary more * πŸ› FIX: Some deprecated warnings for support PHP-8 * πŸ€– Chore: Fix release command and composer allowed plugin list
1 parent 6eedad8 commit 9c44b39

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

β€Žcomposer.jsonβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,11 @@
4242
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
4343
"phpcompatibility/phpcompatibility-wp": "2.1.0",
4444
"wp-coding-standards/wpcs": "^2.3.0"
45+
},
46+
"config": {
47+
"allow-plugins": {
48+
"kylekatarnls/update-helper": true,
49+
"dealerdirect/phpcodesniffer-composer-installer": true
50+
}
4551
}
4652
}

β€Žcore/Singletonable.phpβ€Ž

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function apply_callables( array $callables = [] ) {
7676

7777
if ( method_exists( $this, $method ) ) {
7878

79-
if ( property_exists( $this, $property ) ) {
79+
if ( ! empty( $property ) && property_exists( $this, $property ) ) {
8080
$this->$property = call_user_func_array(
8181
array( $this, $method ),
8282
$params
@@ -105,16 +105,6 @@ protected function __construct() {
105105
private function __clone() {
106106

107107
}
108-
109-
/**
110-
* Private unserialize method to prevent unserializing of the *Singleton*
111-
* instance.
112-
*
113-
* @return void
114-
*/
115-
private function __wakeup() {
116-
117-
}
118108
}
119109

120110
//Example: singleton() first param

β€Žcore/User_Profile/Profile_Update.phpβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ protected function capbility_form( $user ) {
106106
<?php
107107
}
108108

109-
public function profile_update( $user_id = 0, $prev_data ) {
109+
public function profile_update( $user_id, $prev_data ) {
110110
if (
111111
! isset( $_POST['pm_profile_nonce'] )
112-
||
112+
||
113113
! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['pm_profile_nonce'] ) ), 'pm_nonce' )
114114
) {
115115
return;
@@ -121,6 +121,8 @@ public function profile_update( $user_id = 0, $prev_data ) {
121121
return;
122122
}
123123

124+
$user_id = empty( $user_id ) ? 0 : absint( $user_id );
125+
124126
$this->update_user_capability( $user_id, $cap_key );
125127

126128
do_action( 'pm_update_profile', $user_id, $prev_data );

β€Žlibs/functions.phpβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ function pm_filter_content_url( $content ) {
662662
return $content;
663663
}
664664

665-
function pm_get_user_url( $user_id = false, $is_admin ) {
666-
$user_id = $user_id ? $user_id : get_current_user_id();
665+
function pm_get_user_url( $user_id, $is_admin ) {
666+
$user_id = ! empty( $user_id ) ? $user_id : get_current_user_id();
667667

668668
$is_admin = $is_admin ? 'admin' : 'frontend';
669669
$pm_base = pm_get_project_page($is_admin);

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"start": "webpack --progress --colors --watch",
1111
"build": "cross-env NODE_ENV=production webpack --progress --colors ",
12-
"release": "webpack --progress --colors gurnt zip",
12+
"release": "webpack --progress --colors grunt zip",
1313
"makepot": "wpvuei18n makepot"
1414
},
1515
"repository": {

β€Žsrc/Task_List/Controllers/Task_List_Controller.phpβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,17 @@ public function list_search( WP_REST_Request $request ) {
595595
return $this->get_response( $resource );
596596
}
597597

598-
public function get_lists_tasks_count( $list_ids = [], $project_id, $filter_params = [] ) {
598+
public function get_lists_tasks_count( $list_ids, $project_id, $filter_params = [] ) {
599599
global $wpdb;
600600

601601
if ( empty( $list_ids ) ) {
602602
$list_ids[] = 0;
603603
}
604604

605+
if ( ! is_array( $list_ids ) ) {
606+
$list_ids = [];
607+
}
608+
605609
$tb_tasks = pm_tb_prefix() . 'pm_tasks';
606610
$tb_lists = pm_tb_prefix() . 'pm_boards';
607611
$tb_boardable = pm_tb_prefix() . 'pm_boardables';

β€Žviews/assets/src/components/importtools/trello.vueβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<label for="">{{ __( 'Provide your App Key & Token', 'wedevs-project-manager') }}</label>
2020
</div>
2121
<div class="wpuf-int-field">
22-
<input id="app_key" name="app_key" placeholder="__('App Key', 'wedevs-project-manager' )" class="regular-text">
23-
<input id="app_token" name="app_token" placeholder="__('App Token', 'wedevs-project-manager' )" class="regular-text">
22+
<input id="app_key" name="app_key" :placeholder="__('App Key', 'wedevs-project-manager' )" class="regular-text">
23+
<input id="app_token" name="app_token" :placeholder="__('App Token', 'wedevs-project-manager' )" class="regular-text">
2424
</div>
2525
<div class="wpuf-int-field">
2626
<div v-if="trello.import_loader.length != 0">

β€Žviews/assets/src/components/settings/email.vueβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<td>
2323
<fieldset>
2424
<label for="wpuf-pm_mails[email_url_link][backend]">
25-
<input v-model="link_to_backend" type="checkbox" class="radio">{{ __( 'Link to Backend', 'wedevs-project-manager') }}
25+
<input v-model="link_to_backend" type="checkbox" class="radio">&nbsp;{{ __( 'Link to Backend', 'wedevs-project-manager') }}
2626
</label>
2727
<br>
2828
<p class="description">{{ __( 'Select where do you want to take the user. Notification emails contain links.', 'wedevs-project-manager') }}

0 commit comments

Comments
Β (0)