';
}
}
}
if ( ! $check_is_singular ) {
$output = apply_filters( 'astra_blog_post_featured_image_after', $output );
}
$output = apply_filters( 'astra_get_post_thumbnail', $output, $before, $after );
if ( $echo ) {
echo $before . $output . $after; // WPCS: XSS OK.
} else {
return $before . $output . $after;
}
}
}
/**
* Function to check if it is Internet Explorer
*/
if ( ! function_exists( 'astra_check_is_ie' ) ) :
/**
* Function to check if it is Internet Explorer.
*
* @return true | false boolean
*/
function astra_check_is_ie() {
$is_ie = false;
$ua = htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8' );
if ( strpos( $ua, 'Trident/7.0' ) !== false ) {
$is_ie = true;
}
return apply_filters( 'astra_check_is_ie', $is_ie );
}
endif;
/**
* Replace heade logo.
*/
if ( ! function_exists( 'astra_replace_header_logo' ) ) :
/**
* Replace header logo.
*
* @param array $image Size.
* @param int $attachment_id Image id.
* @param sting $size Size name.
* @param string $icon Icon.
*
* @return array Size of image
*/
function astra_replace_header_logo( $image, $attachment_id, $size, $icon ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( ! is_customize_preview() && $custom_logo_id == $attachment_id && 'full' == $size ) {
$data = wp_get_attachment_image_src( $attachment_id, 'ast-logo-size' );
if ( false != $data ) {
$image = $data;
}
}
return apply_filters( 'astra_replace_header_logo', $image );
}
endif;
/**
* Function to check if it is Internet Explorer
*/
if ( ! function_exists( 'astra_replace_header_attr' ) ) :
/**
* Replace header logo.
*
* @param array $attr Image.
* @param object $attachment Image obj.
* @param sting $size Size name.
*
* @return array Image attr.
*/
function astra_replace_header_attr( $attr, $attachment, $size ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( $custom_logo_id == $attachment->ID ) {
$attach_data = array();
if ( ! is_customize_preview() ) {
$attach_data = wp_get_attachment_image_src( $attachment->ID, 'ast-logo-size' );
if ( isset( $attach_data[0] ) ) {
$attr['src'] = $attach_data[0];
}
}
$file_type = wp_check_filetype( $attr['src'] );
$file_extension = $file_type['ext'];
if ( 'svg' == $file_extension ) {
$attr['width'] = '100%';
$attr['height'] = '100%';
$attr['class'] = 'astra-logo-svg';
}
$diff_retina_logo = astra_get_option( 'different-retina-logo' );
if ( '1' == $diff_retina_logo ) {
$retina_logo = astra_get_option( 'ast-header-retina-logo' );
$attr['srcset'] = '';
if ( apply_filters( 'astra_main_header_retina', true ) && '' !== $retina_logo ) {
$cutom_logo = wp_get_attachment_image_src( $custom_logo_id, 'full' );
$cutom_logo_url = $cutom_logo[0];
if ( astra_check_is_ie() ) {
// Replace header logo url to retina logo url.
$attr['src'] = $retina_logo;
}
$attr['srcset'] = $cutom_logo_url . ' 1x, ' . $retina_logo . ' 2x';
}
}
}
return apply_filters( 'astra_replace_header_attr', $attr );
}
endif;
add_filter( 'wp_get_attachment_image_attributes', 'astra_replace_header_attr', 10, 3 );
/**
* Astra Color Palletes.
*/
if ( ! function_exists( 'astra_color_palette' ) ) :
/**
* Astra Color Palletes.
*
* @return array Color Palletes.
*/
function astra_color_palette() {
$color_palette = array(
'#000000',
'#ffffff',
'#dd3333',
'#dd9933',
'#eeee22',
'#81d742',
'#1e73be',
'#8224e3',
);
return apply_filters( 'astra_color_palettes', $color_palette );
}
endif;
if ( ! function_exists( 'astra_get_theme_name' ) ) :
/**
* Get theme name.
*
* @return string Theme Name.
*/
function astra_get_theme_name() {
$theme_name = __( 'Astra', 'astra' );
return apply_filters( 'astra_theme_name', $theme_name );
}
endif;
if ( ! function_exists( 'astra_strposa' ) ) :
/**
* Strpos over an array.
*
* @since 1.2.4
* @param String $haystack The string to search in.
* @param Array $needles Array of needles to be passed to strpos().
* @param integer $offset If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string.
*
* @return bool True if haystack if part of any of the $needles.
*/
function astra_strposa( $haystack, $needles, $offset = 0 ) {
if ( ! is_array( $needles ) ) {
$needles = array( $needles );
}
foreach ( $needles as $query ) {
if ( strpos( $haystack, $query, $offset ) !== false ) {
// stop on first true result.
return true;
}
}
return false;
}
endif;
if ( ! function_exists( 'astra_get_addon_name' ) ) :
/**
* Get Addon name.
*
* @return string Addon Name.
*/
function astra_get_addon_name() {
$pro_name = __( 'Astra Pro', 'astra' );
// If addon is not updated & White Label added for Addon then show the updated addon name.
if ( class_exists( 'Astra_Ext_White_Label_Markup' ) ) {
$plugin_data = Astra_Ext_White_Label_Markup::$branding;
if ( '' != $plugin_data['astra-pro']['name'] ) {
$pro_name = $plugin_data['astra-pro']['name'];
}
}
return apply_filters( 'astra_addon_name', $pro_name );
}
endif;
if ( ! function_exists( 'astra_get_prop' ) ) :
/**
* Get a specific property of an array without needing to check if that property exists.
*
* Provide a default value if you want to return a specific value if the property is not set.
*
* @since 1.2.7
* @access public
* @author Gravity Forms - Easiest Tool to Create Advanced Forms for Your WordPress-Powered Website.
* @link https://www.gravityforms.com/
*
* @param array $array Array from which the property's value should be retrieved.
* @param string $prop Name of the property to be retrieved.
* @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
*
* @return null|string|mixed The value
*/
function astra_get_prop( $array, $prop, $default = null ) {
if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
return $default;
}
if ( isset( $array[ $prop ] ) ) {
$value = $array[ $prop ];
} else {
$value = '';
}
return empty( $value ) && null !== $default ? $default : $value;
}
endif;
/**
* Build list of attributes into a string and apply contextual filter on string.
*
* The contextual filter is of the form `astra_attr_{context}_output`.
*
* @since 1.6.2
* @credits - Genesis Theme By StudioPress.
*
* @param string $context The context, to build filter name.
* @param array $attributes Optional. Extra attributes to merge with defaults.
* @param array $args Optional. Custom data to pass to filter.
* @return string String of HTML attributes and values.
*/
function astra_attr( $context, $attributes = array(), $args = array() ) {
return Astra_Attr::get_instance()->astra_attr( $context, $attributes, $args );
}
/**
* Return affiliate id.
*
* @since 1.6.9
*
* @return int affiliate id.
*/
function astra_filter_ninja_forms_affiliate_id() {
return 1115254;
};
add_filter( 'ninja_forms_affiliate_id', 'astra_filter_ninja_forms_affiliate_id' );