Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address Woo Quality Insight recommendations #606

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions classes/admin/class-klarna-for-woocommerce-addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,16 @@ public function change_klarna_addon_status() {
$new_action = 'install';
$new_status_label = 'Not installed';
$new_action_label = 'Install';
} else {
if ( 'installed' === $result['status'] ) {
} elseif ( 'installed' === $result['status'] ) {
$new_status = 'installed';
$new_action = 'activate';
$new_status_label = 'Installed';
$new_action_label = 'Activate';
} else {
$new_status = 'not-installed';
$new_action = 'install';
$new_status_label = 'Not installed';
$new_action_label = 'Install';
}
} else {
$new_status = 'not-installed';
$new_action = 'install';
$new_status_label = 'Not installed';
$new_action_label = 'Install';
}
}
}
Expand Down Expand Up @@ -327,7 +325,7 @@ public function install_plugin( $url ) {
}
$skin = new Klarna_Skin();
$installer = new Plugin_Upgrader( $skin );
$result = $installer->install( $url );
$result = $installer->install( $url ); // nosemgrep: URL already escape, and user is authorized.

wp_cache_flush();
if ( is_wp_error( $result ) ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/class-kco-credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function get_credentials_from_session() {

$credentials = array(
'merchant_id' => $this->settings[ $test_string . 'merchant_id_' . $country_string ],
'shared_secret' => htmlspecialchars_decode( $this->settings[ $test_string . 'shared_secret_' . $country_string ] ),
'shared_secret' => htmlspecialchars_decode( $this->settings[ $test_string . 'shared_secret_' . $country_string ], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ),
MichaelBengtsson marked this conversation as resolved.
Show resolved Hide resolved
);

return apply_filters( 'kco_wc_credentials_from_session', $credentials, $this->settings['testmode'] );
Expand Down
2 changes: 1 addition & 1 deletion classes/class-kco-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public static function fields() {
$settings = array_merge( array_slice( $settings, 0, $offset + 1, true ), array( 'checkout_flow' => $checkout_flow ), array_slice( $settings, $offset, null, true ) );
} else {
$option = 'woocommerce_kco_settings';
$stored_settings = get_option( $option );
$stored_settings = get_option( $option, array() );
$stored_settings['checkout_flow'] = 'embedded';
update_option( $option, $stored_settings );
}
Expand Down
1 change: 1 addition & 0 deletions includes/kco-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function kco_wc_show_snippet( $pay_for_order = false ) {

if ( isset( $klarna_order['html_snippet'] ) ) {
do_action( 'kco_wc_show_snippet', $klarna_order );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We trust the HTML snippet.
MichaelBengtsson marked this conversation as resolved.
Show resolved Hide resolved
echo kco_extract_script( $klarna_order['html_snippet'] );
}
}
Expand Down
Loading