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

Use iDEAL SVG images from pronamic/wp-pay-logos #44

Closed
remcotolsma opened this issue Jun 6, 2024 · 0 comments · Fixed by #45
Closed

Use iDEAL SVG images from pronamic/wp-pay-logos #44

remcotolsma opened this issue Jun 6, 2024 · 0 comments · Fixed by #45
Assignees

Comments

@remcotolsma
Copy link
Member

// Loop issuers.
foreach ( $this->choices as $choice ) {
// Ignore choices without value.
if ( \array_key_exists( 'value', $choice ) && empty( $choice['value'] ) ) {
continue;
}
// Icon file name.
$issuer = strtr( strtolower( $choice['text'] ), $replacements );
if ( false !== stripos( $issuer, 'test' ) || false !== stripos( $issuer, 'simulation' ) ) {
$issuer = 'test';
}
if ( ! is_dir( $images_path . $issuer ) && is_dir( $images_path . $issuer . '-bank' ) ) {
$issuer .= '-bank';
}
$icon_path = sprintf(
'%s/icon-%s.png',
$issuer,
implode( 'x', $dimensions )
);
// Radio input.
$label_content = sprintf( '<span>%s</span>', esc_html( $choice['text'] ) );
if ( file_exists( plugin_dir_path( Plugin::$file ) . 'images/' . $icon_path ) ) {
$icon_url = plugins_url( 'images/' . $icon_path, Plugin::$file );
$label_content = sprintf(
'<img src="%2$s" alt="%1$s" srcset="%3$s 2x, %4$s 3x, %5$s 4x" /><span>%1$s</span>',
esc_html( $choice['text'] ),
esc_url( $icon_url ),
esc_url( str_replace( '.png', '@2x.png', $icon_url ) ),
esc_url( str_replace( '.png', '@3x.png', $icon_url ) ),
esc_url( str_replace( '.png', '@4x.png', $icon_url ) )
);
}
printf(
'<li class="gchoice_%1$s_%2$s_%3$s"><input type="radio" id="choice_%1$s_%2$s_%3$s" name="input_%2$s" value="%3$s" /> <label for="choice_%1$s_%2$s_%3$s">%4$s</label></li>',
esc_attr( $this->formId ),
esc_attr( $this->id ),
esc_attr( $choice['value'] ),
wp_kses_post( $label_content )
);
}

Related issue:

@remcotolsma remcotolsma self-assigned this Jun 6, 2024
@remcotolsma remcotolsma changed the title Use iDEAL SVG images from https://github.com/pronamic/wp-pay-logos Use iDEAL SVG images from pronamic/wp-pay-logos Jun 6, 2024
@remcotolsma remcotolsma moved this from Todo to In Progress in Pronamic Pay Jun 6, 2024
@remcotolsma remcotolsma linked a pull request Jun 6, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pronamic Pay Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant