
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php

/* -----------------------------------------------------------------------------
 * Build Template Path
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_build_template_path' ) ) {
	function presso_build_template_path( $slug, $name='', $format = '' ) {
		$paths = array();

		if ( ! empty( $name ) ) {
			if ( ! empty( $format ) ) {
				$paths[] = sprintf( get_template_directory().'/%s-%s-%s.php', $slug, $name, $format );
			}
			
			$paths[] = sprintf( get_template_directory().'/%s-%s.php', $slug, $name );
		}

		$paths[] = sprintf( get_template_directory().'/%s.php', $slug );

		foreach ( $paths as $path ) {
			if ( file_exists( $path ) ) {
				return $path;
			}
		}
	}
}


/* -----------------------------------------------------------------------------
 * Hex with opacity
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_rgba' ) ) {
	function presso_rgba( $hex, $opacity=1 ) {
		preg_match_all( '/([0-9a-f]{2})/i', $hex, $match );
		return sprintf( 'rgba(%s,%s,%s,%s)', hexdec($match[1][0]), hexdec($match[1][1]), hexdec($match[1][2]), $opacity );
	}
}


/* -----------------------------------------------------------------------------
 * Check RTL mode
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_is_rtl' ) ) {
	function presso_is_rtl() {
		return is_rtl() || presso_get_theme_option( 'site_force_enable_rtl', false );
	}
}


/* -----------------------------------------------------------------------------
 * Number prefixs
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_number_prefixes' ) ) {
	function presso_number_prefixes( $number ) {
		if ( $number>1000000000 ) return round( ( $number/1000000000 ), 1 ).'B';
		elseif ( $number>1000000 ) return round( ( $number/1000000 ), 1 ).'M';
		elseif ( $number>1000 ) return round( ( $number/1000 ), 1 ).'k';
		else return number_format( intval( $number ) );
	}
}


/* -----------------------------------------------------------------------------
 * Is Caching Enabled?
 * -------------------------------------------------------------------------- */
if ( ! function_exists( 'presso_is_caching_enabled' ) ) {
	function presso_is_caching_enabled() {
		return defined( 'WP_CACHE' ) && WP_CACHE;
	}
}