?AlkantarClanX12

Your IP : 216.73.217.134


Current Path : /home/r/a/n/rankinh/villavanille/wp-content/plugins/drew-core/inc/title/
Upload File :
Current File : /home/r/a/n/rankinh/villavanille/wp-content/plugins/drew-core/inc/title/helper.php

<?php

if ( ! function_exists( 'drew_core_is_page_title_enabled' ) ) {
	/**
	 * Function that check is module enabled
	 *
	 * @param bool $is_enabled
	 *
	 * @return bool
	 */
	function drew_core_is_page_title_enabled( $is_enabled ) {

		$option      = 'no' !== drew_core_get_option_value( 'admin', 'qodef_enable_page_title' );
		$option      = apply_filters( 'drew_core_filter_is_page_title_enabled', $option );
		$meta_option = drew_core_get_option_value( 'meta-box', 'qodef_enable_page_title', '', qode_framework_get_page_id() );
		$option      = '' === $meta_option ? $option : 'yes' === $meta_option;

		if ( ! $option ) {
			$is_enabled = false;
		}

		return $is_enabled;
	}

	add_filter( 'drew_filter_enable_page_title', 'drew_core_is_page_title_enabled', 10 );
}

if ( ! function_exists( 'drew_core_get_page_title_image_params' ) ) {
	/**
	 * Function that return parameters for page title image
	 *
	 * @return array
	 */
	function drew_core_get_page_title_image_params() {
		$background_image = drew_core_get_post_value_through_levels( 'qodef_page_title_background_image' );
		$image_behavior   = drew_core_get_post_value_through_levels( 'qodef_page_title_background_image_behavior' );

		$params = array(
			'image'          => ! empty( $background_image ) ? $background_image : '',
			'image_behavior' => ! empty( $image_behavior ) ? $image_behavior : '',
		);

		return $params;
	}
}

if ( ! function_exists( 'drew_core_get_page_title_image' ) ) {
	/**
	 * Function that render page title image html
	 */
	function drew_core_get_page_title_image() {
		$image_params = drew_core_get_page_title_image_params();

		if ( ! empty( $image_params['image'] ) && 'responsive' === $image_params['image_behavior'] ) {
			echo '<div class="qodef-m-image">' . wp_get_attachment_image( $image_params['image'], 'full' ) . '</div>';
		}

		if ( ! empty( $image_params['image'] ) && 'parallax' === $image_params['image_behavior'] ) {
			echo '<div class="qodef-parallax-img-holder"><div class="qodef-parallax-img-wrapper">' . wp_get_attachment_image( $image_params['image'], 'full', false, array( 'class' => 'qodef-parallax-img' ) ) . '</div></div>';
		}
	}
}

if ( ! function_exists( 'drew_core_get_page_title_decoration_params' ) ) {
	/**
	 * Function that return parameters for page title decoration
	 *
	 * @return array
	 */
	function drew_core_get_page_title_decoration_params() {
		$decoration_image               = drew_core_get_post_value_through_levels( 'qodef_page_title_decoration_image' );
		$decoration_image_bottom_offset = drew_core_get_post_value_through_levels( 'qodef_page_title_decoration_image_bottom_offset' );
		$decoration_image_right_offset  = drew_core_get_post_value_through_levels( 'qodef_page_title_decoration_image_right_offset' );

		if ( ! empty( $decoration_image_bottom_offset ) && ! qode_framework_string_ends_with_space_units( $decoration_image_bottom_offset ) ) {
			$decoration_image_bottom_offset = intval( $decoration_image_bottom_offset ) . 'px';
		}

		if ( ! empty( $decoration_image_right_offset ) && ! qode_framework_string_ends_with_space_units( $decoration_image_right_offset ) ) {
			$decoration_image_right_offset = intval( $decoration_image_right_offset ) . 'px';
		}

		$params = array(
			'image'               => ! empty( $decoration_image ) ? $decoration_image : '',
			'image_bottom_offset' => ! empty( $decoration_image_bottom_offset ) ? $decoration_image_bottom_offset : 0,
			'image_right_offset'  => ! empty( $decoration_image_right_offset ) ? $decoration_image_right_offset : 0,
		);

		return $params;
	}
}

if ( ! function_exists( 'drew_core_get_page_title_decoration' ) ) {
	/**
	 * Function that render page title decoration html
	 */
	function drew_core_get_page_title_decoration() {
		$decoration_params = drew_core_get_page_title_decoration_params();

		if ( ! empty( $decoration_params['image'] ) ) {
			$styles = array(
				'position: absolute',
				'bottom: ' . $decoration_params['image_bottom_offset'],
				'right: ' . $decoration_params['image_right_offset'],
			);
			echo '<div class="qodef-m-decoration" ' . qode_framework_get_inline_style( $styles ) . '>' . wp_get_attachment_image( $decoration_params['image'], 'full' ) . '</div>';
		}
	}
}

if ( ! function_exists( 'drew_core_get_page_title_content_classes' ) ) {
	/**
	 * Function that return classes for page title content area
	 *
	 * @return string
	 */
	function drew_core_get_page_title_content_classes() {
		$classes      = array();
		$image_params = drew_core_get_page_title_image_params();

		$enable_title_grid      = 'no' !== drew_core_get_post_value_through_levels( 'qodef_set_page_title_area_in_grid' );
		$is_grid_enabled        = apply_filters( 'drew_core_filter_page_title_in_grid', $enable_title_grid );
		$enable_title_grid_meta = drew_core_get_option_value( 'meta-box', 'qodef_set_page_title_area_in_grid', '', qode_framework_get_page_id() );
		$is_grid_enabled        = '' === $enable_title_grid_meta ? $is_grid_enabled : 'yes' === $enable_title_grid_meta;

		$classes[] = $is_grid_enabled ? 'qodef-content-grid' : 'qodef-content-full-width';
		$classes[] = 'parallax' === $image_params['image_behavior'] ? 'qodef-parallax-content-holder' : '';

		return implode( ' ', $classes );
	}
}