= 100 && $weigth <= 900 ) {
$sanitized_weights[] = $weigth;
}
}
if ( isset( $font_data[ $sanitized_font_name ] ) && is_array( $font_data[ $sanitized_font_name ] ) ) {
$sanitized_weights = array_unique( array_merge( $font_data[ $sanitized_font_name ], $sanitized_weights ) );
}
$font_data[ $sanitized_font_name ] = $sanitized_weights;
return $font_data;
}
);
}
/**
* Icon HTML
*
* @param string $icon_name icon name.
* @return string
*/
public static function get_icon_html( $icon_name ) {
$html = '';
if ( empty( $icon_name ) ) {
return $html;
}
$path = OPTN_DIR . '/assets/images/icon-library/' . $icon_name . '.svg';
if ( file_exists( $path ) ) {
$html = file_get_contents( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
}
return $html;
}
/**
* Get link opening tag html
*
* @param object $link link attribute.
* @param string $attr extra attributes.
* @return string
*/
public static function get_link_opening_tag_html( $link, $attr ) {
$html = 'doFollow ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$html .= 'rel="nofollow" ';
} elseif ( $link->sponsored ) {
$html .= 'rel="sponsored" ';
}
if ( $link->download ) {
$html .= 'download ';
}
$html .= ' >';
return $html;
}
/**
* Class for hiding elements responsively
*
* @param object $attr attributes.
* @return string
*/
public static function get_resp_hide_classes( &$attr ) {
$cls = array();
if ( isset( $attr->hideDesktop ) && $attr->hideDesktop ) { // phpcs:ignore
$cls[] = 'optn-hide-desktop';
}
if ( isset( $attr->hideTab ) && $attr->hideTab ) { // phpcs:ignore
$cls[] = 'optn-hide-tablet';
}
if ( isset( $attr->hideMobile ) && $attr->hideMobile ) { // phpcs:ignore
$cls[] = 'optn-hide-mobile';
}
return count( $cls ) < 1 ? '' : ' ' . implode( ' ', $cls ) . ' ';
}
/**
* Watermark HTML
*
* @return string
*/
public static function get_watermark_html() {
$html = '';
$path = OPTN_DIR . '/assets/images/watermark.svg';
if ( file_exists( $path ) ) {
$html .= '';
$html .= file_get_contents( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$html .= '';
}
return $html;
}
/**
* Undocumented function
*
* @param array $attr_array attributes array.
* @return string
*/
public static function build_html_attrs( $attr_array ) {
$res = '';
foreach ( $attr_array as $key => $value ) {
if ( is_array( $value ) ) {
$attrs_str = implode( ' ', $value );
$res .= $key . '="' . $attrs_str . '" ';
} else {
$res .= $key . '="' . $value . '" ';
}
}
return $res;
}
}