Skip to content

Commit df78061

Browse files
committed
[static-analysis] Fix undeclared variables errors.
1 parent 0c85dd0 commit df78061

File tree

5 files changed

+45
-40
lines changed

5 files changed

+45
-40
lines changed

templates/account.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,11 @@ class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( '
468468
);
469469
}
470470
} else {
471+
$bundle_title = ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) : '' );
471472
if ( $show_plan_row ) {
472473
$profile[] = array(
473474
'id' => 'plan',
474-
'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
475+
'title' => $bundle_title . ' ' . $plan_text,
475476
'value' => strtoupper( is_string( $plan->name ) ?
476477
$plan->title :
477478
strtoupper( $free_text )
@@ -482,7 +483,7 @@ class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( '
482483
$profile[] = array(
483484
'id' => 'bundle_plan',
484485
'title' => $bundle_plan_text,
485-
'value' => $bundle_plan_title
486+
'value' => $bundle_title
486487
);
487488
}
488489
}
@@ -870,8 +871,8 @@ class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"
870871

871872
<?php
872873
if ( $show_billing ) {
873-
$view_params = array( 'id' => $VARS['id'], 'payments' => $payments );
874-
fs_require_once_template( 'account/billing.php', $view_params );
874+
$view_params = array( 'id' => $VARS['id'], 'payments' => $payments ); // @phpstan-ignore-line
875+
fs_require_once_template( 'account/billing.php', $view_params );
875876
fs_require_once_template( 'account/payments.php', $view_params );
876877
}
877878
?>

templates/account/partials/addon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@
158158
<!--/ ID -->
159159

160160
<!-- Version -->
161-
<td><?php echo $version ?></td>
161+
<td><?php echo $version; // @phpstan-ignore-line ?></td>
162162
<!--/ Version -->
163163

164164
<!-- Plan Title -->
165-
<td><?php echo strtoupper( is_string( $plan_name ) ? $plan_title : $free_text ) ?></td>
165+
<td><?php echo strtoupper( is_string( $plan_name ) ? $plan_title : $free_text ); // @phpstan-ignore-line ?></td>
166166
<!--/ Plan Title -->
167167

168168
<!-- Expiration -->

templates/account/partials/site.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,13 @@ class="dashicons dashicons-arrow-right-alt2"></i>
323323
$downgrade_confirmation_message = sprintf(
324324
$downgrade_x_confirm_text,
325325
( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
326-
$plan->title,
326+
$plan_title,
327327
$human_readable_license_expiration
328328
);
329329

330330
$after_downgrade_message = ! $license->is_block_features ?
331-
sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) :
332-
sprintf( $after_downgrade_blocking_text, $plan->title );
331+
sprintf( $after_downgrade_non_blocking_text, $plan_title, $fs->get_module_label( true ) ) :
332+
sprintf( $after_downgrade_blocking_text, $plan_title );
333333
?>
334334
<?php $action = 'downgrade_account' ?>
335335
<form id="fs_downgrade" action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">

templates/debug.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,25 @@
296296
}
297297
?>
298298
<?php
299-
$fs = null;
299+
$fs = null;
300+
$has_api_connectivity = false;
301+
300302
if ( $is_active ) {
301-
$fs = freemius( $data->id );
303+
$fs = freemius( $data->id );
304+
$has_api_connectivity = $fs->has_api_connectivity();
302305

303306
$active_modules_by_id[ $data->id ] = true;
304307
}
305308
?>
306-
<tr<?php if ( $is_active ) {
307-
$has_api_connectivity = $fs->has_api_connectivity();
308-
309-
if ( true === $has_api_connectivity && $fs->is_on() ) {
310-
echo ' style="background: #E6FFE6; font-weight: bold"';
311-
} else {
312-
echo ' style="background: #ffd0d0; font-weight: bold"';
309+
<tr <?php
310+
if ( $is_active ) {
311+
if ( true === $has_api_connectivity && $fs->is_on() ) {
312+
echo 'style="background: #E6FFE6; font-weight: bold"';
313+
} else {
314+
echo 'style="background: #ffd0d0; font-weight: bold"';
315+
}
313316
}
314-
} ?>>
317+
?>>
315318
<td><?php echo $data->id ?></td>
316319
<td><?php echo $slug ?></td>
317320
<td><?php echo $data->version ?></td>

templates/forms/affiliation.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,29 @@
121121
?></strong></p>
122122
</div>
123123
<?php else : ?>
124-
<?php
125-
$message_text = '';
126-
127-
if ( $is_pending_affiliate ) {
128-
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, we'll review your details during the next 14 days and will get back to you with further information.", 'affiliate-application-thank-you', $slug );
129-
$message_container_class = 'updated';
130-
} else if ( $affiliate->is_suspended() ) {
131-
$message_text = fs_text_inline( 'Your affiliation account was temporarily suspended.', 'affiliate-account-suspended', $slug );
132-
$message_container_class = 'notice notice-warning';
133-
} else if ( $affiliate->is_rejected() ) {
134-
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, unfortunately, we've decided at this point to reject your application. Please try again in 30 days.", 'affiliate-application-rejected', $slug );
135-
$message_container_class = 'error';
136-
} else if ( $affiliate->is_blocked() ) {
137-
$message_text = fs_text_inline( 'Due to violation of our affiliation terms, we decided to temporarily block your affiliation account. If you have any questions, please contact support.', 'affiliate-account-blocked', $slug );
138-
$message_container_class = 'error';
139-
}
140-
?>
141-
<div class="<?php echo $message_container_class ?>">
142-
<p><strong><?php echo esc_html( $message_text ) ?></strong></p>
143-
</div>
144-
<?php endif ?>
124+
<?php
125+
$message_text = '';
126+
$message_container_class = '';
127+
128+
if ( $is_pending_affiliate ) {
129+
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, we'll review your details during the next 14 days and will get back to you with further information.", 'affiliate-application-thank-you', $slug );
130+
$message_container_class = 'updated';
131+
} else if ( $affiliate->is_suspended() ) {
132+
$message_text = fs_text_inline( 'Your affiliation account was temporarily suspended.', 'affiliate-account-suspended', $slug );
133+
$message_container_class = 'notice notice-warning';
134+
} else if ( $affiliate->is_rejected() ) {
135+
$message_text = fs_text_inline( "Thank you for applying for our affiliate program, unfortunately, we've decided at this point to reject your application. Please try again in 30 days.", 'affiliate-application-rejected', $slug );
136+
$message_container_class = 'error';
137+
} else if ( $affiliate->is_blocked() ) {
138+
$message_text = fs_text_inline( 'Due to violation of our affiliation terms, we decided to temporarily block your affiliation account. If you have any questions, please contact support.', 'affiliate-account-blocked', $slug );
139+
$message_container_class = 'error';
140+
}
141+
?>
142+
<div class="<?php echo $message_container_class ?>">
143+
<p><strong><?php echo esc_html( $message_text ) ?></strong></p>
144+
</div>
145145
<?php endif ?>
146+
<?php endif ?>
146147
</div>
147148
<div class="entry-content">
148149
<?php if ( ! $is_affiliate ) : ?>

0 commit comments

Comments
 (0)