Skip to content

Commit

Permalink
Fix PHP-8 Compatibility and Translation (#447)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ManiruzzamanAkash authored Jul 14, 2022
1 parent 6eedad8 commit 9c44b39
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/phpcompatibility-wp": "2.1.0",
"wp-coding-standards/wpcs": "^2.3.0"
},
"config": {
"allow-plugins": {
"kylekatarnls/update-helper": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
12 changes: 1 addition & 11 deletions core/Singletonable.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function apply_callables( array $callables = [] ) {

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

if ( property_exists( $this, $property ) ) {
if ( ! empty( $property ) && property_exists( $this, $property ) ) {
$this->$property = call_user_func_array(
array( $this, $method ),
$params
Expand Down Expand Up @@ -105,16 +105,6 @@ protected function __construct() {
private function __clone() {

}

/**
* Private unserialize method to prevent unserializing of the *Singleton*
* instance.
*
* @return void
*/
private function __wakeup() {

}
}

//Example: singleton() first param
Expand Down
6 changes: 4 additions & 2 deletions core/User_Profile/Profile_Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ protected function capbility_form( $user ) {
<?php
}

public function profile_update( $user_id = 0, $prev_data ) {
public function profile_update( $user_id, $prev_data ) {
if (
! isset( $_POST['pm_profile_nonce'] )
||
||
! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['pm_profile_nonce'] ) ), 'pm_nonce' )
) {
return;
Expand All @@ -121,6 +121,8 @@ public function profile_update( $user_id = 0, $prev_data ) {
return;
}

$user_id = empty( $user_id ) ? 0 : absint( $user_id );

$this->update_user_capability( $user_id, $cap_key );

do_action( 'pm_update_profile', $user_id, $prev_data );
Expand Down
4 changes: 2 additions & 2 deletions libs/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,8 @@ function pm_filter_content_url( $content ) {
return $content;
}

function pm_get_user_url( $user_id = false, $is_admin ) {
$user_id = $user_id ? $user_id : get_current_user_id();
function pm_get_user_url( $user_id, $is_admin ) {
$user_id = ! empty( $user_id ) ? $user_id : get_current_user_id();

$is_admin = $is_admin ? 'admin' : 'frontend';
$pm_base = pm_get_project_page($is_admin);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"start": "webpack --progress --colors --watch",
"build": "cross-env NODE_ENV=production webpack --progress --colors ",
"release": "webpack --progress --colors gurnt zip",
"release": "webpack --progress --colors grunt zip",
"makepot": "wpvuei18n makepot"
},
"repository": {
Expand Down
6 changes: 5 additions & 1 deletion src/Task_List/Controllers/Task_List_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,17 @@ public function list_search( WP_REST_Request $request ) {
return $this->get_response( $resource );
}

public function get_lists_tasks_count( $list_ids = [], $project_id, $filter_params = [] ) {
public function get_lists_tasks_count( $list_ids, $project_id, $filter_params = [] ) {
global $wpdb;

if ( empty( $list_ids ) ) {
$list_ids[] = 0;
}

if ( ! is_array( $list_ids ) ) {
$list_ids = [];
}

$tb_tasks = pm_tb_prefix() . 'pm_tasks';
$tb_lists = pm_tb_prefix() . 'pm_boards';
$tb_boardable = pm_tb_prefix() . 'pm_boardables';
Expand Down
4 changes: 2 additions & 2 deletions views/assets/src/components/importtools/trello.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<label for="">{{ __( 'Provide your App Key & Token', 'wedevs-project-manager') }}</label>
</div>
<div class="wpuf-int-field">
<input id="app_key" name="app_key" placeholder="__('App Key', 'wedevs-project-manager' )" class="regular-text">
<input id="app_token" name="app_token" placeholder="__('App Token', 'wedevs-project-manager' )" class="regular-text">
<input id="app_key" name="app_key" :placeholder="__('App Key', 'wedevs-project-manager' )" class="regular-text">
<input id="app_token" name="app_token" :placeholder="__('App Token', 'wedevs-project-manager' )" class="regular-text">
</div>
<div class="wpuf-int-field">
<div v-if="trello.import_loader.length != 0">
Expand Down
2 changes: 1 addition & 1 deletion views/assets/src/components/settings/email.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td>
<fieldset>
<label for="wpuf-pm_mails[email_url_link][backend]">
<input v-model="link_to_backend" type="checkbox" class="radio">{{ __( 'Link to Backend', 'wedevs-project-manager') }}
<input v-model="link_to_backend" type="checkbox" class="radio">&nbsp;{{ __( 'Link to Backend', 'wedevs-project-manager') }}
</label>
<br>
<p class="description">{{ __( 'Select where do you want to take the user. Notification emails contain links.', 'wedevs-project-manager') }}
Expand Down

0 comments on commit 9c44b39

Please sign in to comment.