File: /home/lesanew/www/wp-content/plugins/neobeat-core/inc/footer/helper.php
<?php
if ( ! function_exists( 'neobeat_core_is_page_footer_enabled' ) ) {
/**
* Function that check is module enabled
*
* @param $is_enabled bool
*
* @return bool
*/
function neobeat_core_is_page_footer_enabled( $is_enabled ) {
$option = neobeat_core_get_post_value_through_levels( 'qodef_enable_page_footer' ) !== 'no';
if ( ! $option ) {
$is_enabled = false;
}
return $is_enabled;
}
add_filter( 'neobeat_filter_enable_page_footer', 'neobeat_core_is_page_footer_enabled' );
}
if ( ! function_exists( 'neobeat_core_is_footer_top_area_enabled' ) ) {
/**
* Function that check if page footer top area widgets are empty
*
* @param $is_enabled bool
*
* @return bool
*/
function neobeat_core_is_footer_top_area_enabled( $is_enabled ) {
$option = neobeat_core_get_post_value_through_levels( 'qodef_enable_top_footer_area' ) !== 'no';
if ( ! $option ) {
$is_enabled = false;
}
return $is_enabled;
}
add_filter( 'neobeat_filter_enable_footer_top_area', 'neobeat_core_is_footer_top_area_enabled' );
}
if ( ! function_exists( 'neobeat_core_is_footer_bottom_area_enabled' ) ) {
/**
* Function that check if page footer bottom area widgets are empty
*
* @param $is_enabled bool
*
* @return bool
*/
function neobeat_core_is_footer_bottom_area_enabled( $is_enabled ) {
$option = neobeat_core_get_post_value_through_levels( 'qodef_enable_bottom_footer_area' ) !== 'no';
if ( ! $option ) {
$is_enabled = false;
}
return $is_enabled;
}
add_filter( 'neobeat_filter_enable_footer_bottom_area', 'neobeat_core_is_footer_bottom_area_enabled' );
}
if ( ! function_exists( 'neobeat_core_set_footer_holder_classes' ) ) {
/**
* Function that return classes for page footer area
*
* @param array $classes
*
* @return array
*/
function neobeat_core_set_footer_holder_classes( $classes ) {
$footer_skin = neobeat_core_get_post_value_through_levels( 'qodef_footer_skin' );
if ( ! empty( $footer_skin ) && $footer_skin !== 'none' ) {
$classes[] = 'qodef-footer--' . $footer_skin;
}
return $classes;
}
add_filter( 'neobeat_core_filter_footer_holder_classes', 'neobeat_core_set_footer_holder_classes' );
}
if ( ! function_exists( 'neobeat_core_set_footer_top_area_classes' ) ) {
/**
* Function that return classes for page footer top area
*
* @param $classes string
*
* @return string
*/
function neobeat_core_set_footer_top_area_classes( $classes ) {
$is_grid_enabled = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_top_area_in_grid' ) !== 'no';
$footer_top_alignment = neobeat_core_get_post_value_through_levels( 'qodef_top_footer_area_content_alignment' );
if ( ! $is_grid_enabled ) {
$classes = 'qodef-content-full-width';
}
if ( !empty ( $footer_top_alignment ) ) {
$classes .= ' qodef-align--' . $footer_top_alignment;
}
return $classes;
}
add_filter( 'neobeat_filter_footer_top_area_classes', 'neobeat_core_set_footer_top_area_classes' );
}
if ( ! function_exists( 'neobeat_core_set_footer_bottom_area_classes' ) ) {
/**
* Function that return classes for page footer bottom area
*
* @param $classes string
*
* @return string
*/
function neobeat_core_set_footer_bottom_area_classes( $classes ) {
$is_grid_enabled = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_bottom_area_in_grid' ) !== 'no';
$footer_bottom_alignment = neobeat_core_get_post_value_through_levels( 'qodef_bottom_footer_area_content_alignment' );
if ( ! $is_grid_enabled ) {
$classes = 'qodef-content-full-width';
}
if ( !empty ( $footer_bottom_alignment ) ) {
$classes .= ' qodef-align--' . $footer_bottom_alignment;
}
return $classes;
}
add_filter( 'neobeat_filter_footer_bottom_area_classes', 'neobeat_core_set_footer_bottom_area_classes' );
}
if ( ! function_exists( 'neobeat_core_set_footer_sidebars_config' ) ) {
/**
* Function that override default page footer sidebars config
*
* @param $config array
*
* @return array
*/
function neobeat_core_set_footer_sidebars_config( $config ) {
$top_area_columns = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_top_area_columns' );
$bottom_area_columns = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_bottom_area_columns' );
if ( ! empty( $top_area_columns ) ) {
$config['footer_top_sidebars_number'] = $top_area_columns;
}
if ( ! empty( $bottom_area_columns ) ) {
$config['footer_bottom_sidebars_number'] = $bottom_area_columns;
}
return $config;
}
add_filter( 'neobeat_filter_page_footer_sidebars_config', 'neobeat_core_set_footer_sidebars_config' );
}
if ( ! function_exists( 'neobeat_core_set_footer_top_area_columns_classes' ) ) {
/**
* Function that set classes for page footer top area columns
*
* @param $classes array
*
* @return array
*/
function neobeat_core_set_footer_top_area_columns_classes( $classes ) {
$gutter_size = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_top_area_grid_gutter' );
if ( ! empty( $gutter_size ) ) {
$classes[] = 'qodef-gutter--' . esc_attr( $gutter_size );
}
return $classes;
}
add_filter( 'neobeat_filter_footer_top_area_columns_classes', 'neobeat_core_set_footer_top_area_columns_classes' );
}
if ( ! function_exists( 'neobeat_core_set_footer_bottom_area_columns_classes' ) ) {
/**
* Function that set classes for page footer bottom area columns
*
* @param $classes array
*
* @return array
*/
function neobeat_core_set_footer_bottom_area_columns_classes( $classes ) {
$gutter_size = neobeat_core_get_post_value_through_levels( 'qodef_set_footer_bottom_area_grid_gutter' );
if ( ! empty( $gutter_size ) ) {
$classes[] = 'qodef-gutter--' . esc_attr( $gutter_size );
}
return $classes;
}
add_filter( 'neobeat_filter_footer_bottom_area_columns_classes', 'neobeat_core_set_footer_bottom_area_columns_classes' );
}
if ( ! function_exists( 'neobeat_core_set_page_footer_area_styles' ) ) {
/**
* Function that generates page footer area inline styles
*
* @param $style string
*
* @return string
*/
function neobeat_core_set_page_footer_area_styles( $style ) {
$footer_area = array( 'top', 'bottom' );
foreach ( $footer_area as $area ) {
$styles = array();
$background_color = neobeat_core_get_post_value_through_levels( 'qodef_' . $area . '_footer_area_background_color' );
$background_image = neobeat_core_get_post_value_through_levels( 'qodef_' . $area . '_footer_area_background_image' );
$top_border_color = neobeat_core_get_post_value_through_levels( 'qodef_' . $area . '_footer_area_top_border_color' );
$top_border_width = neobeat_core_get_post_value_through_levels( 'qodef_' . $area . '_footer_area_top_border_width' );
if ( ! empty( $background_color ) ) {
$styles['background-color'] = $background_color;
}
if ( ! empty( $background_image ) ) {
$styles['background-image'] = 'url(' . esc_url( wp_get_attachment_image_url( $background_image, 'full' ) ) . ')';
}
if ( ! empty( $top_border_color ) ) {
$styles['border-top-color'] = $top_border_color;
if ( $top_border_width === '' ) {
$styles['border-top-width'] = '1px';
}
}
if ( $top_border_width !== '' ) {
$styles['border-top-width'] = intval( $top_border_width ) . 'px';
}
if ( ! empty( $styles ) ) {
$style .= qode_framework_dynamic_style( '#qodef-page-footer-' . $area . '-area', $styles );
}
}
return $style;
}
add_filter( 'neobeat_filter_add_inline_style', 'neobeat_core_set_page_footer_area_styles' );
}
if ( ! function_exists( 'neobeat_core_set_custom_footer_widget_area' ) ) {
function neobeat_core_set_custom_footer_widget_area( $custom_area, $widget_area ) {
$page_id = qode_framework_get_page_id();
$custom_widget_area = get_post_meta( $page_id, 'qodef_footer_top_custom_widget_area_' . intval( $widget_area ), true );
if ( ! empty( $custom_widget_area ) ) {
return $custom_widget_area;
}
return '';
}
add_filter( 'neobeat_filter_custom_footer_widget_area', 'neobeat_core_set_custom_footer_widget_area', 10, 2 );
}
if ( ! function_exists( 'neobeat_core_set_custom_footer_bottom_widget_area' ) ) {
function neobeat_core_set_custom_footer_bottom_widget_area( $custom_area, $widget_area ) {
$page_id = qode_framework_get_page_id();
$custom_widget_area = get_post_meta( $page_id, 'qodef_footer_bottom_custom_widget_area_' . intval( $widget_area ), true );
if ( ! empty( $custom_widget_area ) ) {
return $custom_widget_area;
}
return '';
}
add_filter( 'neobeat_filter_custom_footer_bottom_widget_area', 'neobeat_core_set_custom_footer_bottom_widget_area', 10, 2 );
}