Skip to content

Commit

Permalink
[static-analysis] Fix php errors from static analysis.
Browse files Browse the repository at this point in the history
  • Loading branch information
bahiirwa committed Apr 16, 2024
1 parent 9d67cdd commit 48aaba0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -14300,15 +14300,15 @@ private function get_parent_and_addons_installs_info() {
$this->get_parent_instance() :
$this;

$installed_addons_ids_map = array();
$installed_addons_ids = array();

$installed_addons_instances = $fs->get_installed_addons();
foreach ( $installed_addons_instances as $instance ) {
$installed_addons_ids_map[] = $instance->get_id();
$installed_addons_ids[] = $instance->get_id();
}

$addons_ids = array_unique( array_merge(
$installed_addons_ids_map,
$installed_addons_ids,
$fs->get_updated_account_addons()
) );

Expand All @@ -14320,6 +14320,7 @@ private function get_parent_and_addons_installs_info() {
)
);

$installed_addons_ids_map = array_flip( $installed_addons_ids );
foreach ( $addons_ids as $addon_id ) {
$is_installed = isset( $installed_addons_ids_map[ $addon_id ] );

Expand Down
2 changes: 1 addition & 1 deletion includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ function plugins_api_filter( $data, $action = '', $args = null ) {
false
);

if ( is_array( $addon_plugin_data ) && $addon_plugin_data['Version'] ) {
if ( is_array( $addon_plugin_data ) && isset( $addon_plugin_data['Version'] ) ) {
$addon_version = $addon_plugin_data['Version'];
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/fs-plugin-info-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function _get_addon_info_filter( $data, $action = '', $args = null ) {
false
);

if ( is_array( $addon_plugin_data ) && $addon_plugin_data['Version'] ) {
if ( is_array( $addon_plugin_data ) && isset( $addon_plugin_data['Version'] ) ) {
$current_addon_version = $addon_plugin_data['Version'];
}
}
Expand Down
8 changes: 4 additions & 4 deletions templates/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

$site_view_params[] = $view_params;

if ( null === $install ) {
if ( is_object( $install ) ) {
continue;
}

Expand Down Expand Up @@ -186,6 +186,7 @@

$bundle_subscription = null;
$is_bundle_first_payment_pending = false;
$bundle_plan_title = '';

if (
$show_plan_row &&
Expand Down Expand Up @@ -468,11 +469,10 @@ class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( '
);
}
} else {
$bundle_title = ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) : '' );
if ( $show_plan_row ) {
$profile[] = array(
'id' => 'plan',
'title' => $bundle_title . ' ' . $plan_text,
'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
'value' => strtoupper( is_string( $plan->name ) ?
$plan->title :
strtoupper( $free_text )
Expand All @@ -483,7 +483,7 @@ class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( '
$profile[] = array(
'id' => 'bundle_plan',
'title' => $bundle_plan_text,
'value' => $bundle_title
'value' => $bundle_plan_title
);
}
}
Expand Down

0 comments on commit 48aaba0

Please sign in to comment.