$value ) { if ( empty( $value ) ) { continue; } if ( true === $value ) { $html .= ' ' . esc_html( $key ); } else { $html .= sprintf( ' %s="%s"', esc_html( $key ), ( 'href' === $key ) ? esc_url( $value ) : esc_attr( $value ) ); } } /** * This filters the output of the html attributes. * * @param string $html The HTML attr output. * @param array $attr The array with all HTML attributes to render. * @param string $context The context in wich this functionis called. * @param null $args Optional. Extra arguments in case is needed. * * @var string */ $html = apply_filters( "italystrap_attr_{$context}_output", $html, $attr, $context, $args ); if ( ! $echo ) { return $html; } echo $html; } } if ( ! function_exists( 'ItalyStrap\HTML\is_HTML' ) ) { /** * https://subinsb.com/php-check-if-string-is-html/ * * @param string $string * * @return bool */ function is_HTML( $string ) { return $string !== strip_tags( $string ); } }