';
/** @psalm-suppress DocblockTypeContradiction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! self::$ast_svgs ) {
ob_start();
include_once ASTRA_THEME_DIR . 'assets/svg/svgs.json'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
self::$ast_svgs = json_decode( ob_get_clean(), true );
self::$ast_svgs = apply_filters( 'astra_svg_icons', self::$ast_svgs );
}
$output .= isset( self::$ast_svgs[ $icon ] ) ? self::$ast_svgs[ $icon ] : '';
$output .= '';
return $output;
}
/**
* Prepare Social Icon HTML.
*
* @param string $index The Index of the social icon.
* @param string $builder_type the type of the builder.
*/
public static function render_social_icon( $index, $builder_type = 'header' ) {
$items = astra_get_option( $builder_type . '-social-icons-' . $index );
$items = isset( $items['items'] ) ? $items['items'] : array();
$show_label = astra_get_option( $builder_type . '-social-' . $index . '-label-toggle' );
$color_type = astra_get_option( $builder_type . '-social-' . $index . '-color-type' );
$social_stack = astra_get_option( $builder_type . '-social-' . $index . '-stack', 'none' );
echo '
';
if ( is_customize_preview() ) {
self::render_customizer_edit_button();
}
echo '
';
if ( is_array( $items ) && ! empty( $items ) ) {
foreach ( $items as $item ) {
if ( $item['enabled'] ) {
$link = $item['url'];
switch ( $item['id'] ) {
case 'phone':
$link = 'tel:' . $item['url'];
break;
case 'email':
$link = 'mailto:' . $item['url'];
break;
case 'whatsapp':
$link = 'https://api.whatsapp.com/send?phone=' . $item['url'];
break;
}
/**
* Filter the social links rel attribute.
*
* @param string $rel Social link's rel attribute.
* @param array $item Social icon item.
*
* @since 4.8.10
*
* @psalm-suppress TooManyArguments
*/
$rel = apply_filters( 'astra_social_icon_attribute_rel', 'noopener noreferrer', $item );
echo sprintf(
'
',
esc_url( $link ),
esc_attr( $item['label'] ? $item['label'] : $item['id'] ),
in_array( $item['id'], [ 'phone', 'email' ], true ) ? '' : sprintf( 'target="_blank" rel="%s"', esc_attr( $rel ) ),
esc_attr( ! empty( $item['color'] ) ? $item['color'] : '#3a3a3a' ),
esc_attr( ! empty( $item['background'] ) ? $item['background'] : 'transparent' ),
esc_attr( $item['id'] ),
esc_attr( $builder_type )
);
echo self::fetch_svg_icon( $item['icon'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( $show_label ) {
echo '' . esc_html( $item['label'] ) . '';
}
echo '';
}
}
}
echo apply_filters( 'astra_social_icons_after', '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '
';
echo '
';
}
/**
* Prepare HTML Markup.
*
* @param string $index Key of the HTML Control.
*/
public static function render_html_markup( $index = 'header-html-1' ) {
$theme_author = astra_get_theme_author_details();
$content = astra_get_i18n_option( $index, Astra_Builder_Helper::get_translatable_string( $index ) );
if ( $content || is_customize_preview() ) {
$link_style = '';
echo '';
}
}
/**
* Prepare Edit icon inside customizer.
*
* @param string $class custom class.
* @since 3.9.4
*/
public static function render_customizer_edit_button( $class = '' ) { ?>
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo astra_get_custom_button( $builder_type . '-button' . $index . '-text', $builder_type . '-button' . $index . '-link-option', 'header-button' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Site Identity.
*
* @param string $device Device name.
*/
public static function render_site_identity( $device ) {
?>
'site-branding ast-site-identity',
)
)
);
?>
>
$flyout_cart_unit_breakpoint ? 'ast-large-view' : '';
?>