HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/frenchy/refonte2023/wordpress/wp-content/plugins/ova-exhibition/inc/ovaex-core-functions.php
<?php

if ( !defined( 'ABSPATH' ) ) {
	exit;
}

if( !function_exists( 'ovaex_locate_template' ) ){
	function ovaex_locate_template( $template_name, $template_path = '', $default_path = '' ) {
		
		// Set variable to search in ovaex-templates folder of theme.
		if ( ! $template_path ) :
			$template_path = 'ovaex-templates/';
		endif;

		// Set default plugin templates path.
		if ( ! $default_path ) :
			$default_path = OVAEX_PLUGIN_PATH . 'templates/'; // Path to the template folder
		endif;

		// Search template file in theme folder.
		$template = locate_template( array(
			$template_path . $template_name
			// $template_name
		) );

		// Get plugins template file.
		if ( ! $template ) :
			$template = $default_path . $template_name;
		endif;

		return apply_filters( 'ovaex_locate_template', $template, $template_name, $template_path, $default_path );
	}

}


function ovaex_get_template( $template_name, $args = array(), $tempate_path = '', $default_path = '' ) {
	if ( is_array( $args ) && isset( $args ) ) :
		extract( $args );
	endif;
	$template_file = ovaex_locate_template( $template_name, $tempate_path, $default_path );
	if ( ! file_exists( $template_file ) ) :
		_doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $template_file ), '1.0.0' );
		return;
	endif;


	include $template_file;
}


function ovaex_pagination_plugin($ovaex_query = null) {
	/** Stop execution if there's only 1 page */
	if ( $ovaex_query != null ) {
		if ( $ovaex_query->max_num_pages <= 1 ) return;	
	} elseif ( $wp_query->max_num_pages <= 1 ) return;

	$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;

	if ( $ovaex_query!=null ) {
		$max   = intval( $ovaex_query->max_num_pages );
	} else {
		$max   = intval( $wp_query->max_num_pages );	
	}
	
	/** Add current page to the array */
	if ( $paged >= 1 )
		$links[] = $paged;

	/** Add the pages around the current page to the array */
	if ( $paged >= 3 ) {
		$links[] = $paged - 1;
		$links[] = $paged - 2;
	}

	if ( ( $paged + 2 ) <= $max ) {
		$links[] = $paged + 2;
		$links[] = $paged + 1;
	}


	echo wp_kses( '<div class="blog_pagination"><ul class="pagination">', true ) . "\n";
	
	/** Previous Post Link */
	if ( get_previous_posts_link() )
		printf( '<li class="prev page-numbers">%s</li>' . "\n", get_previous_posts_link('<i class="arrow_carrot-left"></i>') );
	
	/** Link to first page, plus ellipses if necessary */
	if ( ! in_array( 1, $links ) ) {
		$class = 1 == $paged ? ' class="active"' : '';
		
		printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
		
		if ( ! in_array( 2, $links ) )
			echo wp_kses( '<li><span class="pagi_dots">...</span></li>', true);
	}
	
	/** Link to current page, plus 2 pages in either direction if necessary */
	sort( $links );
	foreach ( (array) $links as $link ) {
		$class = $paged == $link ? ' class="active"' : '';
		printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
	}
	
	/** Link to last page, plus ellipses if necessary */
	if ( ! in_array( $max, $links ) ) {
		if ( ! in_array( $max - 1, $links ) )
			echo wp_kses( '<li><span class="pagi_dots">...</span></li>', true) . "\n";
		
		$class = $paged == $max ? ' class="active"' : '';
		printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
	}
	
	/** Next Post Link */
	$max_page = $ovaex_query->max_num_pages;
	if ( get_next_posts_link( null, $max_page ) )
		printf( '<li class="next page-numbers">%s</li>' . "\n", get_next_posts_link( '<i class="arrow_carrot-right"></i>', $max_page ) );
	
	echo wp_kses( '</ul></div>', true ) . "\n";

}

add_filter( 'gimont_header_customize', 'gimont_header_customize_exhibtion', 10, 1 );
function gimont_header_customize_exhibtion( $header ){


	if( is_tax( 'cat_exhibition' ) || is_post_type_archive( 'exhibition' ) ){

	  	$header = OVAEX_Settings::archive_exhibition_header();

	}else if( is_singular( 'exhibition' ) ){

		$header = OVAEX_Settings::single_exhibition_header();
		
	}

	return $header;

}


add_filter( 'gimont_footer_customize', 'gimont_footer_customize_exhibtion', 10, 1 );
function gimont_footer_customize_exhibtion( $footer ){
    
    if( is_tax( 'cat_exhibition' ) || is_post_type_archive( 'exhibition' ) ){

        $footer = OVAEX_Settings::archive_exhibition_footer();

    }else if( is_singular( 'exhibition' ) ){

        $footer = OVAEX_Settings::single_exhibition_footer();

    }

    return $footer;

}