| Server IP : 62.72.47.131 / Your IP : 216.73.217.34 Web Server : Apache/2.4.66 (Debian) System : Linux 975cdb959a49 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : ( 501) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/themes/flatsome/inc/classes/ |
Upload File : |
<?php
/**
* Icon handling.
*
* @package Flatsome
*/
defined( 'ABSPATH' ) || exit;
/**
* Class Flatsome_Icon
*/
final class Flatsome_Icon {
/**
* Get a payment icon using get_template_part.
*
* @param string $icon_name The name of the payment icon.
* @param array $args Optional arguments for the icon.
*
* @return string The payment icon HTML.
*/
public static function get_payment_icon( $icon_name, $args = [] ) {
$defaults = [
'attributes' => [
'aria-hidden' => 'true',
],
];
$args = wp_parse_args( $args, $defaults );
ob_start();
get_template_part( 'assets/img/payment-icons/icon', $icon_name . '.svg' );
$svg = ob_get_clean();
if ( empty( $svg ) ) {
return '';
}
$p = new WP_HTML_Tag_Processor( $svg );
if ( $p->next_tag( 'svg' ) && ! empty( $args['attributes'] ) ) {
foreach ( $args['attributes'] as $attribute => $value ) {
if ( $attribute === 'class' ) {
$existing_class = $p->get_attribute( 'class' );
$classes = ! empty( $existing_class )
? $existing_class . ' ' . $value
: $value;
$p->set_attribute( 'class', $classes );
} else {
$p->set_attribute( $attribute, $value );
}
}
}
return $p->get_updated_html();
}
}