updated plugin Menu Icons version 0.12.11

This commit is contained in:
2022-03-21 13:35:08 +00:00
committed by Gitium
parent dee8d18381
commit a9ffa6605d
42 changed files with 3531 additions and 3006 deletions

View File

@ -380,9 +380,24 @@ final class Menu_Icons_Front_End {
* @return string
*/
public static function get_font_icon( $meta ) {
$classes = sprintf( '%s %s %s', self::get_icon_classes( $meta ), $meta['type'], $meta['icon'] );
$style = self::get_icon_style( $meta, array( 'font_size', 'vertical_align' ) );
$type = $meta['type'];
$icon = $meta['icon'];
$font_awesome5 = font_awesome5_backward_compatible();
if ( ! empty( $type ) && 'fa' === $type ) {
$icon = explode( ' ', $icon );
$type = reset( $icon );
$icon = end( $icon );
$fa_icon = sprintf( '%s-%s', $type, $icon );
if ( array_key_exists( $fa_icon, $font_awesome5 ) ) {
$fa5_icon = $font_awesome5[ $fa_icon ];
$fa5_class = explode( ' ', $fa5_icon );
$type = reset( $fa5_class );
$icon = end( $fa5_class );
}
}
$classes = sprintf( '%s %s %s', self::get_icon_classes( $meta ), $type, $icon );
$style = self::get_icon_style( $meta, array( 'font_size', 'vertical_align' ) );
return sprintf( '<i class="%s" aria-hidden="true"%s></i>', esc_attr( $classes ), $style );
}
@ -453,10 +468,13 @@ final class Menu_Icons_Front_End {
if ( ! empty( $height ) ) {
$height = sprintf( ' height="%dpx"', $height );
}
$image_alt = get_post_meta( $meta['icon'], '_wp_attachment_image_alt', true );
$image_alt = $image_alt ? wp_strip_all_tags( $image_alt ) : '';
return sprintf(
'<img src="%s" class="%s" aria-hidden="true"%s%s%s/>',
'<img src="%s" class="%s" aria-hidden="true" alt="%s"%s%s%s/>',
esc_url( wp_get_attachment_url( $meta['icon'] ) ),
esc_attr( $classes ),
$image_alt,
$width,
$height,
$style