Components -> Link * */ if ( ! defined( 'ABSPATH' ) ) exit; if ( ! function_exists( 'tbkkt_link_format_rel' ) ) : function tbkkt_link_format_rel( bool $new_tab, string $extra ): string { $tokens = preg_split( '/\s+/', trim( $extra ), -1, PREG_SPLIT_NO_EMPTY ); if ( ! is_array( $tokens ) ) $tokens = array(); if ( $new_tab ) : foreach ( array( 'noopener', 'noreferrer' ) as $req ) : if ( ! in_array( $req, $tokens, true ) ) : $tokens[] = $req; endif; endforeach; endif; $allowed = array( 'nofollow', 'sponsored', 'ugc', 'noopener', 'noreferrer' ); $out = array(); foreach ( $tokens as $t ) : $t = strtolower( trim( (string) $t ) ); if ( $t !== '' && in_array( $t, $allowed, true ) ) : $out[] = $t; endif; endforeach; return implode( ' ', array_unique( $out ) ); } endif; if ( ! function_exists( 'tbkkt_link_opening_attributes_fragment' ) ) : function tbkkt_link_opening_attributes_fragment( string $href_raw, bool $new_tab, string $rel_extra, bool $decorative, string $label, string $link_class = 'tbkkt-icon-link' ): string { $href = esc_url( trim( $href_raw ) ); if ( $href === '' ) return ''; $out = ' href="' . $href . '" class="' . esc_attr( $link_class ) . '"'; if ( $new_tab ) : $out .= ' target="_blank"'; endif; $rel = tbkkt_link_format_rel( $new_tab, $rel_extra ); if ( $rel !== '' ) : $out .= ' rel="' . esc_attr( $rel ) . '"'; endif; if ( ! $decorative && trim( $label ) !== '' ) : $out .= ' aria-label="' . esc_attr( trim( $label ) ) . '"'; endif; return $out; } endif;