HEX
Server: Apache
System: Linux main79 6.1.0-52-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.180-1 (2026-08-03) x86_64
User: serwer143450 (7544)
PHP: 7.4.33
Disabled: opcache_reset, opcache_invalidate, opcache_compile_file, opcache_get_configuration, opcache_get_status
Upload Files
File: /home/platne/serwer143450/public_html/exzo.hillconnect.pl/wp-content/themes/exzo/functions.php
<?php

/**
 * Classexzo
 * 
 * 
 */

function exzo_theme_add_editor_styles() {


	add_editor_style( 'editor-styles.css' );




}
add_action( 'admin_menu', 'exzo_theme_add_editor_styles' );

function exzo_setup_theme_supported_features() {
	add_theme_support( 'editor-color-palette', array(
		array(
			'name' => __( 'strong magenta', 'themeLangDomain' ),
			'slug' => 'strong-magenta',
			'color' => '#a156b4',
		),
		array(
			'name' => __( 'light grayish magenta', 'themeLangDomain' ),
			'slug' => 'light-grayish-magenta',
			'color' => '#d0a5db',
		),
		array(
			'name' => __( 'very light gray', 'themeLangDomain' ),
			'slug' => 'very-light-gray',
			'color' => '#eee',
		),
		array(
			'name' => __( 'very dark gray', 'themeLangDomain' ),
			'slug' => 'very-dark-gray',
			'color' => '#444',
		),
	) );
}

add_action( 'after_setup_theme', 'exzo_setup_theme_supported_features' );


class exzo_class {

	public function __construct() {
		// Include required files
		$this->exzo_includes();
		/**
		 * Hooks
		 */
		add_action( 'after_setup_theme', array( $this, 'exzo_crucial_setup' ) );

		// widgets
		add_action( 'widgets_init', array( $this, 'exzo_arphabet_widgets_init' ) );

		//filters
		add_filter( 'body_class', array( $this, 'exzo_add_body_class' ) );
		//theme support
		$this->exzo_theme_support_setting();
	}

	/**
	 * theme support setting
	 */
	function exzo_theme_support_setting() {
		add_theme_support( 'editor-styles' );
		add_theme_support( 'custom-background' );
		add_theme_support( 'woocommerce' );
		add_theme_support( "title-tag" );
		add_theme_support( 'automatic-feed-links' );
		add_theme_support( "custom-header", array() );
		add_theme_support( 'post-thumbnails' );
		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'title-tag' );
		set_post_thumbnail_size( 849, 450, true );
		add_theme_support( 'wp-block-styles' );




		// add image size
		add_image_size( "exzo_post", 849, 450, true );
		add_image_size( "exzo_post_gallery", 847, 487, true );
		add_image_size( "exzo_shop_cart", 85, 85, true );
		add_image_size( 'exzo-featured_preview', 55, 55, true );
		add_image_size( 'exzo-image-848x438-croped', 848, 438, true );
		add_image_size( 'exzo-image-263x185-croped', 263, 185, false );
		add_image_size( 'exzo-image-263x185', 263, 185, false );
		add_image_size( 'exzo-image-262x155-croped', 262, 155, true );
		add_image_size( 'exzo-image-70x60-croped', 70, 60, true );
		add_image_size( 'exzo-image-370x229-croped', 370, 229, true );
		add_image_size( 'exzo-image-200x200-croped', 200, 200, false );
		add_image_size( 'exzo-image-200x200', 200, 200, false );
		add_image_size( 'exzo-image-167x167-croped', 167, 167, true );
		add_image_size( 'exzo-image-92x92-croped', 92, 92, true );
		add_image_size( 'exzo-image-92x92', 92, 92, false );
		add_image_size( 'exzo-image-250x250-croped', 250, 250, true );
		add_image_size( 'exzo-image-555x474-croped', 555, 474, true );
		add_image_size( 'exzo-image-30x30-croped', 125, 125, true );
		add_image_size( 'exzo-image-235x320-croped', 235, 320, true );
		add_image_size( 'exzo-image-585x293-croped', 585, 293, true );
		add_image_size( 'exzo-image-555x474-croped', 555, 474, true );
		add_image_size( 'exzo-image-450x450-croped', 450, 450, true );
		add_image_size( 'exzo-image-265x269-croped', 265, 269, true );
		add_image_size( 'exzo-image-265x269-croped', 265, 269, true );
		add_image_size( 'exzo-image-68x68-croped', 68, 68, true );
		add_image_size( 'exzo-image-550x550-croped', 550, 550, true );


		register_nav_menus(
			array(
				'exzo_topmenu' => esc_html__( 'Header menu', 'exzo' ),
			) );

		add_theme_support( 'html5', array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );
		add_theme_support( 'post-formats', array(
			'video',
			'gallery',
			'quote'
		) );


	}

	/**
	 * require files and function
	 */
	function exzo_includes() {
		//# Part 1. Includes

		//require get_template_directory() . '/assets/widgets.php';
		require get_template_directory() . '/assets/customizer.php';
		require get_template_directory() . '/assets/style_scripts.php';
		require get_template_directory() . '/assets/tgm.php';
		require get_template_directory() . '/assets/categoris-image.php';
		require get_template_directory() . '/assets/ajax_comment.php';
		require get_template_directory() . '/assets/coment_walker.php';
		require get_template_directory() . '/assets/ajax_gallery.php';
		require get_template_directory() . '/assets/shop-comments.php';

		/* woocommerce */
		require get_template_directory() . '/assets/woocomerce_function.php';
	}

	/*     * **********************************************************
	 *                           Hooks Action
	 * ********************************************************** */

	function exzo_crucial_setup() {
		load_theme_textdomain( 'exzo', get_template_directory() . '/languages' );
	}

	/**
	 * register sidebars
	 */
	function exzo_arphabet_widgets_init() {
		register_sidebar( array(
			'name' => esc_html__( 'Blog sidebar', 'exzo' ),
			'id' => 'exzo_sidebar',
			'before_widget' => '<div class="blog_widgets %2$s ">',
			'after_widget' => '</div>',
			'description' => esc_html__( 'sidebar', 'exzo' ),
			'before_title' => '<div class="h4 col-xs-b25">',
			'after_title' => '</div>',
		) );

		register_sidebar( array(
			'name' => esc_html__( 'footer', 'exzo' ),
			'id' => 'exzo_footer',
			'before_widget' => '  <div class="col-sm-6 col-md-3 col-xs-b30 col-md-b0 %2$s ">',
			'after_widget' => '</div>',
			'description' => esc_html__( 'Footer', 'exzo' ),
			'before_title' => '<h6 class="h6 light">',
			'after_title' => '</h6>',
		) );

		register_sidebar( array(
			'name' => esc_html__( 'Shop sidebar', 'exzo' ),
			'id' => 'exzo_shop_sidebar',
			'before_widget' => '<div class="%2$s  blog_widgets">',
			'after_widget' => '</div>',
			'description' => esc_html__( ' shop sidebar', 'exzo' ),
			'before_title' => '<div class="h4 col-xs-b10">',
			'after_title' => '</div>',
		) );


		register_sidebar( array(
			'name' => esc_html__( 'Shop footer sidebar', 'exzo' ),
			'id' => 'exzo_shop_sidebar_footer',
			'before_widget' => '<div class="%2$s  col-sm-6 col-md-3 col-xs-b25">',
			'after_widget' => '</div>',
			'description' => esc_html__( ' shop sidebar', 'exzo' ),
			'before_title' => '<div class="h4 col-xs-b25">',
			'after_title' => '</div>',
		) );
	}

	/**
	 * add custom body class
	 * @param string $classes
	 * @return array
	 */
	function exzo_add_body_class( $classes ) {

		global $post;
		if ( isset( $post->ID ) ) {
			if ( (
				     is_archive() || is_single() || is_page() ) &&
			     get_page_template_slug( $post->ID ) != 'template-fullwidth.php'
			) {
				$classes[] = "exzo_blog ";
			}
		}
		if(is_admin_bar_showing()){
			$classes[] = "admin_bar_showing ";
		}


		return sanitize_html_class( $classes );
	}

	/**
	 *
	 * /************************************************************
	 *                          Metods
	 * ********************************************************** */

	/**
	 * @param $maxchar
	 */
	function truncate_str( $maxchar ) { //Specifies the number of characters
		$out = get_the_excerpt();
		$out = iconv_substr( $out, 0, $maxchar, 'utf-8' );
		$out = preg_replace( '@(.*)\s[^\s]*$@s', '\\1 ', $out );
		echo wp_kses_post( $out );
	}

	/**
	 * @return string
	 */
	function exzo_container_class() {
		$mod = get_theme_mod( "site_Identity_layout", 's2' );
		if ( $mod == "s2" ) {
			return "container-fluid container-fluid_pad_off";
		}
		return "container";
	}

	/****************************************************
	 *                  Helper methods
	 * **************************************************
	 */

	/**
	 * Prepares correct the url to google font
	 * @param $fonts_param
	 * @return string url google fonts
	 */
	function google_fonts_url( $fonts_param ) {
		$font_url = '';
		/*
		  Translators: If there are characters in your language that are not supported
		  by chosen font(s), translate this to 'off'. Do not translate into your own language.
		 */
		if ( 'off' !== esc_html_x( 'on', 'Google font: on or off', 'exzo' ) ) {
			$font_url = add_query_arg( 'family', urlencode( $fonts_param ), "//fonts.googleapis.com/css" );
		}
		$font_url = str_replace( '%2B', '+', $font_url );
		return $font_url;
	}

	/**
	 * @param null $theid
	 * @param int $widht
	 * @param int $height
	 * @param bool|false $big_src if is true the get full img
	 * @param bool|true $default if there is no plug pictures
	 * @param bool|false $return
	 * @return string url new img
	 */
	function get_post_thumbnail( $theid = null, $widht = 848, $height = 450, $big_src = false, $default = true, $return = false ) {

		if ( $theid == null ) {
			$theid = get_the_ID();
		}
		$thumbnail = get_the_post_thumbnail( $theid, 'full' );

		preg_match_all( '#src="(.*?)"#si', $thumbnail, $thumb_url );

		$thumb = "";


		if ( isset( $thumb_url[1][0] ) ) {
			$thumb = esc_url( $thumb_url[1][0] );
		} elseif ( $default ) {
			$thumb = '';
		}
		if ( $big_src ) {
			if ( $return ) {
				return esc_url( $thumb );
			} else {
				echo esc_url( $thumb );
			}
		} else {
			if ( function_exists( 'exzo_resize_image' ) ) {

				$thumb_arr = exzo_resize_image( get_post_thumbnail_id( $theid ), $widht, $height, true );
				$thumb = $thumb_arr['url'];
			}
			if ( $return ) {
				return esc_url( ( $thumb ) );
			} else {
				echo esc_url( ( $thumb ) );
			}
		}
	}

	/**
	 * method return new size img
	 * @param int $widht
	 * @param int $height
	 * @return string
	 */
	function trim_img_by_url( $thumb, $widht = 848, $height = 400 ) {
		return esc_url( ( $thumb ) );
	}

	/**
	 * @param string $before
	 * @param string $after
	 * @param bool|true $echo
	 * @param array $args
	 * @param null $wp_query
	 * @return int|string pagination in categorias
	 */
	function exzo_pagenavi( $max_page = false, $before = '', $after = '', $echo = true, $args = array(), $wp_query = null ) {
		if ( !$wp_query ) {
			global $wp_query;
		}

		// the default settings
		$default_args = array(
			'text_num_page' => '',
			// Text before pagination. {current} - current; {last} - last (pr. 'Page {current} of {last}' get 'Page 4 of 60 ")
			'num_pages' => 10,
			// how many links to display
			'step_link' => 10,
			// Links increments (value - the number, the step size (at. 1,2,3 ... 10,20,30). Put 0 if such references are not needed.
			'dotright_text' => '',
			// intermediate text "to".
			'dotright_text2' => '',
			//intermediate text "after."
			'back_text' => '       <span class="button-wrapper"> <span class="icon"><i class="fa fa-angle-left" aria-hidden="true"></i></span> <span class="text"> ' . esc_html__( 'prev page', 'exzo' ) . '</span> </span>',
			// text "go to the previous page." Put 0 if this reference is not needed
			'next_text' => ' <span class="button-wrapper"> <span class="icon"><i class="fa fa-angle-right" aria-hidden="true"></i></span> <span class="text"> ' . esc_html__( 'next page', 'exzo' ) . '</span> </span>',
			// text "go to the next page." Put 0 if this reference is not needed.
			'first_page_text' => 0,
			// text "to the first page." Put 0 if instead of text you need to show a page number.
			'last_page_text' => 0,
			// text "to the last page." Put 0 if instead of text you need to show a page number.
		);

		$default_args = apply_filters( 'exzo_pagenavi_args', $default_args ); //to be able to establish their default values

		$args = array_merge( $default_args, $args );

		extract( $args );

		$posts_per_page = (int) $wp_query->query_vars['posts_per_page'];
		$paged = (int) $wp_query->query_vars['paged'];
		if ( $max_page == false ) {
			$max_page = $wp_query->max_num_pages;
		}

		//check the need for navigation
		if ( $max_page <= 1 ) {
			return false;
		}

		if ( empty( $paged ) || $paged == 0 ) {
			$paged = 1;
		}

		$pages_to_show = intval( $num_pages );
		$pages_to_show_minus_1 = $pages_to_show - 1;

		$half_page_start = floor( $pages_to_show_minus_1 / 2 ); // how many links to the current page
		$half_page_end = ceil( $pages_to_show_minus_1 / 2 ); // how many links after current page

		$start_page = $paged - $half_page_start; //first page
		$end_page = $paged + $half_page_end; // the last page (conditionally)

		if ( $start_page <= 0 ) {
			$start_page = 1;
		}
		if ( ( $end_page - $start_page ) != $pages_to_show_minus_1 ) {
			$end_page = $start_page + $pages_to_show_minus_1;
		}
		if ( $end_page > $max_page ) {
			$start_page = $max_page - $pages_to_show_minus_1;
			$end_page = (int) $max_page;
		}

		if ( $start_page <= 0 ) {
			$start_page = 1;
		}

		// display navigation
		$out = '';

		// Create a base to cause get_pagenum_link once
		$link_base = str_replace( 99999999, '___', get_pagenum_link( 99999999 ) );
		$first_url = get_pagenum_link( 1 );
		if ( false === strpos( $first_url, '?' ) ) {
			$first_url = user_trailingslashit( $first_url );
		}
		// ago
		if ( $back_text && $paged != 1 ) {
			$out .= '<div class="col-sm-3 hidden-xs "><a class="button size-1 style-5" href="' . ( ( $paged - 1 ) == 1 ? $first_url : str_replace( '___', ( $paged - 1 ), $link_base ) ) . '">' . $back_text . '</a></div> ';
		} else {
			$out .= '<div class="col-sm-3 hidden-xs "><a class=" disabled button size-1 style-5"  >' . $back_text . '</a></div> ';
		}
		$out .= $before . "<div class=\"col-sm-6 text-center\"> <div class='pagination-wrapper'>\n ";

		if ( $text_num_page ) {
			$text_num_page = preg_replace( '!{current}|{last}!', '%s', $text_num_page );
			$out .= sprintf( "<span class='pages'>$text_num_page</span> ", $paged, $max_page );
		}


		// to the begining
		if ( $start_page >= 2 && $pages_to_show < $max_page ) {
			$out .= '<a class="first" href="' . esc_url( $first_url ) . '">' . wp_kses_post( $first_page_text ? $first_page_text : 1 ) . '</a> ';
			if ( $dotright_text && $start_page != 2 ) {
				$out .= '<span class="extend">' . wp_kses_post( $dotright_text ) . '</span> ';
			}
		}
		// pagination
		for ( $i = $start_page; $i <= $end_page; $i ++ ) {
			if ( $i == $paged ) {
				$out .= '<a class="pagination active2" href="#">' . $i . ' <span class="sr-only">(current)</span></a>';
			} elseif ( $i == 1 ) {
				$out .= '<a class="pagination " href="' . esc_url( $first_url ) . '">1</a> ';
			} else {
				$out .= '<a class="pagination" href="' . esc_url( str_replace( '___', $i, $link_base ) ) . '">' . wp_kses_post( $i ) . '</a> ';
			}
		}


		// links increments
		$dd = 0;
		if ( $step_link && $end_page < $max_page ) {
			for ( $i = $end_page + 1; $i <= $max_page; $i ++ ) {
				if ( $i % $step_link == 0 && $i !== $num_pages ) {
					if ( ++ $dd == 1 ) {
						$out .= '<span class="extend">' . $dotright_text2 . '</span> ';
					}
					$out .= '<a class= "pagination" href="' . str_replace( '___', $i, $link_base ) . '">' . $i . '</a>';
				}
			}
		}

		// In the end
		if ( $end_page < $max_page ) {
			if ( $dotright_text && $end_page != ( $max_page - 1 ) ) {
				$out .= '<span class="extend">' . $dotright_text2 . '</span> ';
			}
			$out .= '<a class="last" href="' . str_replace( '___', $max_page, $link_base ) . '">' . ( $last_page_text ? $last_page_text : $max_page ) . '</a> ';
		}


		$out .= "</div> 	</div>" . $after . "\n";
		// forward
		if ( $next_text && $paged != $end_page ) {
			$out .= '<a class="next button size-1 style-5" href="' . str_replace( '___', ( $paged + 1 ), $link_base ) . '">   ' . $next_text . '</a> ';
		} else {

			$out .= '<a class="next disabled button size-1 style-5" href="' . '">' . $next_text . '</a> ';
		}
		$out = apply_filters( 'kama_pagenavi', $out );

		if ( $echo ) {
			return print $out;
		}

		return $out;
	}



	/** get avatar url
	 * @param $user_ID
	 * @param int $width
	 * @param int $height
	 * @param string $class
	 * @param bool $return
	 * @return string
	 */
	function get_url_img_avatar( $user_ID, $width = 128, $height = 128, $class = "", $return = false ) {
		$params = array( 'width' => $width, 'height' => $height, 'crop' => true );
		preg_match( "/src=(.*?) /i", get_avatar( $user_ID, 120 ), $matches );
		$img_url = ( trim( $matches[1] ) );
		if ( $return ) {
			return esc_url( $img_url );
		} else {
			echo '<img src="' . esc_url( $img_url ) . '" class="' . esc_attr( $class ) . '" height="' . esc_attr( $height ) . '" width="' . esc_attr( $width ) . '" alt="">';
		}
	}

}

$GLOBALS['exzo_class'] = new exzo_class();

/**
 * @return mixed
 */
function exzo_get_global_class() {
	global $exzo_class;
	return $exzo_class;
}

/**
 * @return mixed
 */
function exzo_get_global_post() {
	global $post;
	return $post;
}

/**
 * @return WC_Product|Yoast_Product
 */
function exzo_get_global_product() {
	global $product;
	return $product;
}

/**
 * @return mixed
 */
function exzo_get_global_woocommerce_loop() {
	global $woocommerce_loop;
	return $woocommerce_loop;
}

/**
 * @return mixed
 */
function exzo_get_global_woocommerce() {
	global $woocommerce;
	return $woocommerce;
}

function exzo_get_global_comment() {
	global $comment;
	return $comment;
}

add_filter( 'get_the_excerpt', 'exzo_exc', 90 );

/**
 * carves out a brief description of shortcodes
 * @param $param
 * @return mixed
 */
function exzo_exc( $param ) {
	$param = preg_replace( "/\[.*?\].*?\[\/.*?\]/", "", $param );
	$param = preg_replace( "/<.*?>/", "", $param );
	return $param;
}

/**
 * @param bool $path
 * @param bool $is_page
 * @return mixed
 */
function exzo_newBasename( $path = false, $is_page = false ) {
	if ( $path == false && $is_page = false ) {
		$path = get_page_template();
	}
	if ( $path == false && $is_page = true && is_page() ) {
		$path = get_page_template();
	}
	$path = str_replace( '\\', '/', $path );
	$path_array = explode( '/', $path );
	return array_pop( $path_array );
}

/*
 * coments pagination
 */

function exzo_wp_comments_corenavi() {
	$pages = '';
	$max = get_comment_pages_count();
	$page = get_query_var( 'cpage' );
	if ( !$page ) {
		$page = 1;
	}
	$a['current'] = $page;
	$a['echo'] = false;
	$total = 0; //1 - display text "Page N of N", 0 - not to withdraw
	$a['mid_size'] = 3; // how many links to display on the left and right of the current
	$a['end_size'] = 1; // how many links to show the beginning and the end
	$a['prev_text'] = '&laquo;'; // link text "Previous"
	$a['next_text'] = '&raquo;'; // link text "Next page"
	if ( $max > 1 ) {
		echo '<div class="commentNavigation">';
	}
	echo esc_attr( $pages ) . paginate_comments_links( $a );
	if ( $max > 1 ) {
		echo '</div>';
	}
}

/**
 * post pagination
 * @return string
 */
function exzo_link_pages() {
	/* ================ Settings ================ */
	$text_num_page = ''; // The text for the number of pages. {current} is replaced by the current, and {last} the last. Example: "Page {current} of {last} '= Page 4 of 60
	$num_pages = 10; // how many links to display
	$stepLink = 10; // after the navigation links to specific step (value = the number (a pitch) or '' if you do not need to show). Example: 1,2,3 ... 10,20,30
	$dotright_text = '...';
	$dotright_text2 = '...';
	$backtext = '&#171; ';
	$nexttext = '&raquo;';
	$first_page_text = ''; //  text "to the first page" or put '', instead of the text if you need to show a page number.
	$last_page_text = ''; // text "to the last page 'or write' 'if, instead of the text you need to show a page number.
	/* ================ End Settings ================ */
	global $page, $numpages;
	$paged = (int) $page;
	$max_page = $numpages;
	if ( $max_page <= 1 ) {
		return false;
	} //check the need for navigation
	if ( empty( $paged ) || $paged == 0 ) {
		$paged = 1;
	}
	$pages_to_show = intval( $num_pages );
	$pages_to_show_minus_1 = $pages_to_show - 1;
	$half_page_start = floor( $pages_to_show_minus_1 / 2 ); //how many links to the current page
	$half_page_end = ceil( $pages_to_show_minus_1 / 2 ); //how many links after current page
	$start_page = $paged - $half_page_start; //first page
	$end_page = $paged + $half_page_end; //last page (conditionally)
	if ( $start_page <= 0 ) {
		$start_page = 1;
	}
	if ( ( $end_page - $start_page ) != $pages_to_show_minus_1 ) {
		$end_page = $start_page + $pages_to_show_minus_1;
	}
	if ( $end_page > $max_page ) {
		$start_page = $max_page - $pages_to_show_minus_1;
		$end_page = (int) $max_page;
	}
	if ( $start_page <= 0 ) {
		$start_page = 1;
	}
	$out = '';
	$out .= "<div class='pagination-wrapper'>\n";
	if ( $text_num_page ) {
		$text_num_page = preg_replace( '!{current}|{last}!', '%s', $text_num_page );
		$out .= sprintf( " <li class=\"active1\"><a href=\"#\"><span class='sr-only'>$text_num_page</span></a></li>", $paged, $max_page );
	}
	if ( $backtext && $paged != 1 ) {
		$out .= '<li>' . _wp_link_page( ( $paged - 1 ) ) . $backtext . '</a>';
	}
	if ( $start_page >= 2 && $pages_to_show < $max_page ) {
		$out .= _wp_link_page( 1 ) . ( $first_page_text ? $first_page_text : 1 ) . '</a>';
		if ( $dotright_text && $start_page != 2 ) {
			$out .= '<span class="extend">' . $dotright_text . '</span>';
		}
	}
	/*for ( $i = $start_page; $i <= $end_page; $i ++ ) {
		if ( $i == $paged ) {
			$out .= '<a href="#" class=" pagination active">' . $i . ' <span class="sr-only"></span></a>
';
		} else {
			$out .= '<a href= "' . _wp_link_page( $i ) . ' ' . $i . '</a>';
		}
	}*/
	$out .= '<a href= "' . _wp_link_page( $i ) . ' ' . $i . '</a>';
	//Links increments
	if ( $stepLink && $end_page < $max_page ) {
		for ( $i = $end_page + 1; $i <= $max_page; $i ++ ) {
			if ( $i % $stepLink == 0 && $i !== $num_pages ) {
				if ( ++ $dd == 1 ) {
					$out .= '<span class="extend">' . $dotright_text2 . '</span>';
				}
				$out .= '<a href="' . _wp_link_page( $i ) . '"  class="pagination2">' . $i . '</a>';
			}
		}
	}
	if ( $end_page < $max_page ) {
		if ( $dotright_text && $end_page != ( $max_page - 1 ) ) {
			$out .= '<span class="extend">' . $dotright_text2 . '</span>';
		}
		$out .= '' . _wp_link_page( $max_page ) . ( $last_page_text ? $last_page_text : $max_page ) . '</a>';
	}
	if ( $nexttext && $paged != $end_page ) {
		$out .= '' . _wp_link_page( ( $paged + 1 ) ) . $nexttext . '</a>';
	}
	$out .= "</div>";
	$out = str_replace( '"<a href="', '"', $out );
	$out = str_replace( '">">', '" class="pagination3">', $out );
	$out = str_replace( '<a href= "', '<a class="pagination" href="', $out );
	return ( $out );
}

if ( !isset( $content_width ) ) {
	$content_width = 1170;
}


if ( !function_exists( 'exzo_get_youtube_id' ) ) {

	/**
	 * @param $value
	 * @return mixed|null
	 */
	function exzo_get_youtube_id( $value ) {
		$id = null;
		if ( preg_match( '/youtu.be\/(.*)/', $value, $math ) ) {
			$id = $math[1];
		} elseif ( preg_match( '/youtube.com.*?v=(.*)/', $value, $math ) ) {
			$id = $math[1];
		} else {
			$id = $value;
		}

		$id = str_replace( "http://", '', $id );
		$id = str_replace( "https://", '', $id );
		return $id;
	}

}

/**
 * @param $carry
 * @param $item
 * @return mixed|string
 */
function exzo_video_patern( $carry, $item ) {
	if ( strpos( $item, '#' ) === 0 ) {
		// Assuming '#...#i' regexps.
		$item = substr( $item, 1, - 2 );
	} else {
		// Assuming glob patterns.
		$item = str_replace( '*', '(.+)', $item );
	}

	return $carry ? $carry . ')|(' . $item : $item;
}

if ( !function_exists( 'exzo_theme_oembed_videos' ) ) :

	function exzo_theme_oembed_videos() {


		global $post;
		if ( $post && $post->post_content ) {
			global $shortcode_tags;
			// Make a copy of global shortcode tags - we'll temporarily overwrite it.
			$theme_shortcode_tags = $shortcode_tags;
			// The shortcodes we're interested in.
			$shortcode_tags = apply_filters( 'exzo_vide_embed_tags', array(
				'video' => $theme_shortcode_tags['video'],
				'embed' => $theme_shortcode_tags['embed']
			), $theme_shortcode_tags );
			// Get the absurd shortcode regexp.
			$video_regex = '#' . get_shortcode_regex() . '#i';
			// Restore global shortcode tags.
			$shortcode_tags = $theme_shortcode_tags;
			$pattern_array = array( $video_regex );
			$pattern_array = array_merge( $pattern_array, array_keys( $providers = array(
				'#http://((m|www)\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ),
				'#https://((m|www)\.)?youtube\.com/watch.*#i' => array(
					'http://www.youtube.com/oembed?scheme=https',
					true
				),
				'#http://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'http://www.youtube.com/oembed', true ),
				'#https://((m|www)\.)?youtube\.com/playlist.*#i' => array(
					'http://www.youtube.com/oembed?scheme=https',
					true
				),
				'#http://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed', true ),
				'#https://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ),
				'http://blip.tv/*' => array( 'http://blip.tv/oembed/', false ),
				'#https?://(.+\.)?vimeo\.com/.*#i' => array( 'http://vimeo.com/api/oembed.{format}', true ),
				'#https?://(www\.)?dailymotion\.com/.*#i' => array(
					'http://www.dailymotion.com/services/oembed',
					true
				),
				'http://dai.ly/*' => array( 'http://www.dailymotion.com/services/oembed', false ),
				'#https?://(www\.)?flickr\.com/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
				'#https?://flic\.kr/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
				'#https?://(.+\.)?smugmug\.com/.*#i' => array( 'http://api.smugmug.com/services/oembed/', true ),
				'#https?://(www\.)?hulu\.com/watch/.*#i' => array( 'http://www.hulu.com/api/oembed.{format}', true ),
				'http://i*.photobucket.com/albums/*' => array( 'http://photobucket.com/oembed', false ),
				'http://gi*.photobucket.com/groups/*' => array( 'http://photobucket.com/oembed', false ),
				'#https?://(www\.)?scribd\.com/doc/.*#i' => array( 'http://www.scribd.com/services/oembed', true ),
				'#https?://wordpress.tv/.*#i' => array( 'http://wordpress.tv/oembed/', true ),
				'#https?://(.+\.)?polldaddy\.com/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
				'#https?://poll\.fm/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
				'#https?://(www\.)?funnyordie\.com/videos/.*#i' => array( 'http://www.funnyordie.com/oembed', true ),
				'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array(
					'https://api.twitter.com/1/statuses/oembed.{format}',
					true
				),
				'#https?://vine.co/v/.*#i' => array( 'https://vine.co/oembed.{format}', true ),
				'#https?://(www\.)?soundcloud\.com/.*#i' => array( 'http://soundcloud.com/oembed', true ),
				'#https?://(.+?\.)?slideshare\.net/.*#i' => array( 'https://www.slideshare.net/api/oembed/2', true ),
				'#https?://instagr(\.am|am\.com)/p/.*#i' => array( 'https://api.instagram.com/oembed', true ),
				'#https?://(www\.)?rdio\.com/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
				'#https?://rd\.io/x/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
				'#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ),
				'#https?://(.+\.)?imgur\.com/.*#i' => array( 'http://api.imgur.com/oembed', true ),
				'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i' => array( 'http://api.meetup.com/oembed', true ),
				'#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'http://issuu.com/oembed_wp', true ),
				'#https?://(www\.)?collegehumor\.com/video/.*#i' => array(
					'http://www.collegehumor.com/oembed.{format}',
					true
				),
				'#https?://(www\.)?mixcloud\.com/.*#i' => array( 'http://www.mixcloud.com/oembed', true ),
				'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array(
					'http://www.ted.com/talks/oembed.{format}',
					true
				),
				'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array(
					'http://animoto.com/oembeds/create',
					true
				),
				'#https?://(.+)\.tumblr\.com/post/.*#i' => array( 'https://www.tumblr.com/oembed/1.0', true ),
				'#https?://(www\.)?kickstarter\.com/projects/.*#i' => array(
					'https://www.kickstarter.com/services/oembed',
					true
				),
				'#https?://kck\.st/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ),
				'#https?://cloudup\.com/.*#i' => array( 'https://cloudup.com/oembed', true ),
			) ) );
			// Or all the patterns together.

			$pattern = '#(' . array_reduce( $pattern_array, "exzo_video_patern" ) . ')#is';
			// Simplistic parse of content line by line.
			$lines = explode( "\n", $post->post_content );
			$i = 0;
			foreach ( $lines as $line ) {
				$line = trim( $line );
				if ( preg_match( $pattern, $line, $matches ) ) {
					if ( strpos( $matches[0], '[' ) === 0 ) {
						$ret = do_shortcode( $matches[0] );
					} elseif ( preg_match( '#youtu#', $matches[0] ) ) {
						$ret = '<' . 'iframe' . ' src="https://www.youtube.com/embed/' . sanitize_text_field( exzo_get_youtube_id( $matches[0] ) ) . '?feature=oembed" class="youtube_video"  allowfullscreen></iframe>';

					} elseif ( preg_match( '#vimeo#', $matches[0] ) ) {

						$ret = '<' . 'iframe' . ' src="' . sanitize_text_field( ( $matches[0] ) ) . '</iframe>';

					} else {
						$ret = wp_video_shortcode( array( 'src' => $matches[0] ) );
					}
					$ret = preg_replace( '/width=".*?"/', '', $ret );
					$ret = preg_replace( '/height=".*?"/', '', $ret );
					$ret = '<div class="embed-responsive embed-responsive-16by9">' . $ret;
					$ret = $ret . '</div>';
					print( $ret );
				}
			}
		}
	}
endif;


function exzo_theme_get_video_url( $width = 0, $height = 0 ) {

	global $post;
	$ret = '';
	if ( $post && $post->post_content ) {
		global $shortcode_tags;
		// Make a copy of global shortcode tags - we'll temporarily overwrite it.
		$theme_shortcode_tags = $shortcode_tags;
		// The shortcodes we're interested in.
		$shortcode_tags = apply_filters( 'exzo_vide_embed_tags', array(
			'video' => $theme_shortcode_tags['video'],
			'embed' => $theme_shortcode_tags['embed']
		), $theme_shortcode_tags );
		// Get the absurd shortcode regexp.
		$video_regex = '#' . get_shortcode_regex() . '#i';
		// Restore global shortcode tags.
		$shortcode_tags = $theme_shortcode_tags;
		$pattern_array = array( $video_regex );
		$pattern_array = array_merge( $pattern_array, array_keys( $providers = array(
			'#http://((m|www)\.)?youtube\.com/watch.*#i' => array( 'http://www.youtube.com/oembed', true ),
			'#https://((m|www)\.)?youtube\.com/watch.*#i' => array(
				'http://www.youtube.com/oembed?scheme=https',
				true
			),
			'#http://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'http://www.youtube.com/oembed', true ),
			'#https://((m|www)\.)?youtube\.com/playlist.*#i' => array(
				'http://www.youtube.com/oembed?scheme=https',
				true
			),
			'#http://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed', true ),
			'#https://youtu\.be/.*#i' => array( 'http://www.youtube.com/oembed?scheme=https', true ),
			'http://blip.tv/*' => array( 'http://blip.tv/oembed/', false ),
			'#https?://(.+\.)?vimeo\.com/.*#i' => array( 'http://vimeo.com/api/oembed.{format}', true ),
			'#https?://(www\.)?dailymotion\.com/.*#i' => array(
				'http://www.dailymotion.com/services/oembed',
				true
			),
			'http://dai.ly/*' => array( 'http://www.dailymotion.com/services/oembed', false ),
			'#https?://(www\.)?flickr\.com/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
			'#https?://flic\.kr/.*#i' => array( 'https://www.flickr.com/services/oembed/', true ),
			'#https?://(.+\.)?smugmug\.com/.*#i' => array( 'http://api.smugmug.com/services/oembed/', true ),
			'#https?://(www\.)?hulu\.com/watch/.*#i' => array( 'http://www.hulu.com/api/oembed.{format}', true ),
			'http://i*.photobucket.com/albums/*' => array( 'http://photobucket.com/oembed', false ),
			'http://gi*.photobucket.com/groups/*' => array( 'http://photobucket.com/oembed', false ),
			'#https?://(www\.)?scribd\.com/doc/.*#i' => array( 'http://www.scribd.com/services/oembed', true ),
			'#https?://wordpress.tv/.*#i' => array( 'http://wordpress.tv/oembed/', true ),
			'#https?://(.+\.)?polldaddy\.com/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
			'#https?://poll\.fm/.*#i' => array( 'https://polldaddy.com/oembed/', true ),
			'#https?://(www\.)?funnyordie\.com/videos/.*#i' => array( 'http://www.funnyordie.com/oembed', true ),
			'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array(
				'https://api.twitter.com/1/statuses/oembed.{format}',
				true
			),
			'#https?://vine.co/v/.*#i' => array( 'https://vine.co/oembed.{format}', true ),
			'#https?://(www\.)?soundcloud\.com/.*#i' => array( 'http://soundcloud.com/oembed', true ),
			'#https?://(.+?\.)?slideshare\.net/.*#i' => array( 'https://www.slideshare.net/api/oembed/2', true ),
			'#https?://instagr(\.am|am\.com)/p/.*#i' => array( 'https://api.instagram.com/oembed', true ),
			'#https?://(www\.)?rdio\.com/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
			'#https?://rd\.io/x/.*#i' => array( 'http://www.rdio.com/api/oembed/', true ),
			'#https?://(open|play)\.spotify\.com/.*#i' => array( 'https://embed.spotify.com/oembed/', true ),
			'#https?://(.+\.)?imgur\.com/.*#i' => array( 'http://api.imgur.com/oembed', true ),
			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i' => array( 'http://api.meetup.com/oembed', true ),
			'#https?://(www\.)?issuu\.com/.+/docs/.+#i' => array( 'http://issuu.com/oembed_wp', true ),
			'#https?://(www\.)?collegehumor\.com/video/.*#i' => array(
				'http://www.collegehumor.com/oembed.{format}',
				true
			),
			'#https?://(www\.)?mixcloud\.com/.*#i' => array( 'http://www.mixcloud.com/oembed', true ),
			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array(
				'http://www.ted.com/talks/oembed.{format}',
				true
			),
			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array(
				'http://animoto.com/oembeds/create',
				true
			),
			'#https?://(.+)\.tumblr\.com/post/.*#i' => array( 'https://www.tumblr.com/oembed/1.0', true ),
			'#https?://(www\.)?kickstarter\.com/projects/.*#i' => array(
				'https://www.kickstarter.com/services/oembed',
				true
			),
			'#https?://kck\.st/.*#i' => array( 'https://www.kickstarter.com/services/oembed', true ),
			'#https?://cloudup\.com/.*#i' => array( 'https://cloudup.com/oembed', true ),
		) ) );
		// Or all the patterns together.

		$pattern = '#(' . array_reduce( $pattern_array, "exzo_video_patern" ) . ')#is';
		// Simplistic parse of content line by line.
		$lines = explode( "\n", $post->post_content );

		foreach ( $lines as $line ) {


			$line = trim( $line );
			if ( preg_match( $pattern, $line, $matches ) ) {
				if ( strpos( $matches[0], '[' ) === 0 ) {
					$ret = do_shortcode( $matches[0] );
				} elseif ( preg_match( '#youtu#', $matches[0] ) ) {

					$ret = ' https://www.youtube.com/embed/' . sanitize_text_field( exzo_get_youtube_id( $matches[0] ) ) . '?feature=oembed';
					return ( $ret );


				} elseif ( preg_match( '#vimeo#', $matches[0] ) ) {

					$ret = sanitize_text_field( ( $matches[0] ) );

				} else {
					$ret = wp_video_shortcode( array( 'src' => $matches[0] ) );
				}
				$ret = preg_replace( '/width=".*?"/', '', $ret );
				$ret = preg_replace( '/height=".*?"/', '', $ret );


				return esc_url( $ret );
			}
		}
	}
}

if ( !function_exists( 'exzo_post_gallery_slide' ) ) :

	/**
	 * its diplay gallery in posts
	 * @param bool $cut
	 * @param int $width
	 * @param int $height
	 */
	function exzo_post_gallery_slide( $cut = false, $width = 848, $height = 439 ) {

		global $exzo_class, $post;


		$gallery = get_post_gallery_images( $post );
		$width = 848;
		$height = 566;
		$params = array( 'width' => $width, 'height' => $height, 'crop' => true );

		// Make sure the post has a gallery in it
		?>

		<?php
		if ( has_post_thumbnail() ) {

			$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
			$feature_src = wp_get_attachment_image_src( $post_thumbnail_id, 'exzo_post_gallery' );
			?>
            <div class="swiper-slide">
                <img alt="<?php the_title(); ?>"
                     src=<?php echo esc_url( $feature_src[0] ); ?>>
            </div>
			<?php
		}

		foreach ( $gallery as $image_url ) {
			?>
            <div class="swiper-slide">
                <img alt="<?php the_title(); ?>" src=<?php echo esc_url( $image_url ); ?>>
            </div>
			<?php
		}
		?>

		<?php
	}

endif;

function exzo_shortcode_atts_galler() {

}

if ( !function_exists( 'exzo_limit_excerpt' ) ) :

	function exzo_limit_excerpt( $limit, $content = null ) {

		if ( empty( $content ) ) {
			$content = preg_replace( "~(?:\[/?)[^/\]]+/?\]~s", '', get_the_excerpt() );
		}
		$out = $content;
		$out = preg_replace( "#\<code\>.*?\<\/code\>#s", '', $out );
		$out = preg_replace( "#<pre>.*?</pre>#im", '', $out );
		$out = preg_replace( "~(?:\[/?)[^/\]]+/?\]~s", '', $out );
		$out = preg_replace( "#\[.*?\]#", '', $out );
		$out = preg_replace( "#\<.*?\>#", '', $out );

		$excerpt = explode( ' ', $content, $limit + 1 );
		if ( count( $excerpt ) >= $limit ) {
			array_pop( $excerpt );
			$excerpt = implode( " ", $excerpt );
		} else {
			$excerpt = implode( " ", $excerpt );
		}
		$excerpt .= '...';
		$excerpt = preg_replace( '`\[[^\]]*\]`', '', $excerpt );

		$output = $excerpt;

		return $output;
	}

endif;


if ( !function_exists( 'exzo_words_limit' ) ) :

	function exzo_words_limit() {
		$limit = get_theme_mod( 'exzo_blog_list_limit_word' );

		if ( empty( $limit ) ) {
			return 50;
		}

		return $limit;
	}

endif;

if ( !function_exists( 'exzo_post_thumbnail' ) ) :

	/**
	 * Display an optional post thumbnail.
	 *
	 * Wraps the post thumbnail in an anchor element on index views, or a div
	 * element when on single views.
	 *
	 * @since Rent It 1.0
	 */
	function exzo_post_thumbnail() {
		global $exzo_class;

		///$theid = null, $widht = 848, $height = 565, $big_src = false, $default = true, $return = false
		if ( $exzo_class->get_post_thumbnail( get_the_ID(), 0, 0, false, true, true ) == false || post_password_required() || is_attachment() || !has_post_thumbnail() ) {
			return;
		}
		if ( strlen( $exzo_class->get_post_thumbnail( get_the_ID(), 0, 0, 0, 0, 1 ) ) < 5 ) {
			return false;
		}
		?>

        <img class="img-responsive"
             src=" <?php echo esc_url( $exzo_class->get_post_thumbnail( get_the_ID() ) ); ?>"
             alt="<?php the_title(); ?>  ">

		<?php ?>

		<?php
	}

endif;


/* * *
 * modified image size
 * @return string
 */

function exzo_resize_image( $thumb_id, $width, $height, $crop ) {
	// Get the image source for the attachment, note the following:
	// $image_src[0] = the URL of the image
	// $image_src[1] = the width of the image
	// $image_src[2] = the height of the image
	$image_src = wp_get_attachment_image_src( $thumb_id, 'full' );

	// If either the width or height of the full size image is bigger than the target size, then we know we need to resize
	if ( $image_src[1] > $width || $image_src[2] > $height ) {
		$resized_image_path = '';
		$resized_image_url = '';

		$file_path = get_attached_file( $thumb_id );

		// Get the file info and extension
		$file_info = pathinfo( $file_path );
		$extension = '.' . $file_info['extension'];

		// The image path without the extension
		$no_ext_path = $file_info['dirname'] . '/' . $file_info['filename'];

		// Build the cropped image path and URL with the width and height as part of the name
		$cropped_image_path = $no_ext_path . '-' . $width . 'x' . $height . $extension;
		$cropped_image_url = str_replace( basename( $image_src[0] ), basename( $cropped_image_path ), $image_src[0] );

		// Check if resized cropped version already exists (for crop = true but will also work for crop = false if the sizes match)
		if ( file_exists( $cropped_image_path ) ) {
			return array(
				'url' => esc_url( $cropped_image_url ),
				'width' => esc_html( $width ),
				'height' => esc_html( $height )
			);
		} else {
			$resized_image_path = $cropped_image_path;
			$resized_image_url = $cropped_image_url;
		}

		// If crop is false then check proportional image
		if ( $crop == false ) {
			// Calculate the size proportionally
			$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
			$proportional_image_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension;
			$proportional_image_url = str_replace( basename( $image_src[0] ), basename( $proportional_image_path ), $image_src[0] );

			// Check if resized proportional version already exists
			if ( file_exists( $proportional_image_path ) ) {
				return array(
					'url' => esc_url( $proportional_image_url ),
					'width' => esc_html( $proportional_size[0] ),
					'height' => esc_html( $proportional_size[1] )
				);
			} else {
				$resized_image_path = $proportional_image_path;
				$resized_image_url = $proportional_image_url;
			}
		}

		// Getting this far means that neither the cropped resized image nor the proportional
		// resized image exists, so we use a WP_Image_Editor to do the resizing and save to disk


		$image_editor = wp_get_image_editor( $file_path );

		if ( !is_wp_error( $image_editor ) ) {
			$resized = $image_editor->resize( $width, $height, $crop );
			$new_image = $image_editor->save( $resized_image_path );
		} else {
			$resized = NULL;
			$new_image = array( 'width' => 0, 'height' => 0 );
		}

		return array(
			'url' => esc_url( $resized_image_url ),
			'width' => esc_html( $new_image['width'] ),
			'height' => esc_html( $new_image['height'] )
		);
	}

	// Default output, no resizing
	return array(
		'url' => esc_url( $image_src[0] ),
		'width' => esc_html( $image_src[1] ),
		'height' => esc_html( $image_src[2] )
	);
}

/** Generate one page menu
 * add menu elements
 * @param $items
 * @param $args
 * @return string
 */
function exzo_social_menu_item( $items, $args ) {
	$frontpage_id = get_option( 'page_on_front' );
	$post_ID = get_the_ID();
	$newitems = $items;
	$menu_left = '';
	$menu_right = '';

	if ( get_option( 'exzo_one_page_menu' ) == true && ( $args->theme_location == 'exzo_topmenu' || $args->theme_location == 'exzo_topmenu_blog' ) ) {

		if ( !is_front_page() && get_option( 'exzo_one_page_menu_' . $post_ID ) == false ) {
			$menu_left = get_option( 'exzo_one_page_menu' );
			$menu_left = str_replace( '#', get_home_url( '/' ) . '/#', $menu_left );
		} else {


			$menu_left = get_option( 'exzo_one_page_menu_' . $post_ID );
		}
		if ( is_front_page() ) {
			$menu_left = get_option( 'exzo_one_page_menu' );
		}
	}

	if ( get_option( 'exzo_one_page_menu_right' ) == true && ( $args->theme_location == 'exzo_topmenu' || $args->theme_location == 'exzo_topmenu_blog' ) ) {


		if ( !is_front_page() && get_option( 'exzo_one_page_menu_right_' . $post_ID ) == false ) {
			$menu_right = get_option( 'exzo_one_page_menu_right' );;
			$menu_right = str_replace( '#', get_home_url( '/' ) . '/#', $menu_right );
		} else {


			$menu_right = get_option( 'exzo_one_page_menu_right_' . $post_ID );
		}
		if ( is_front_page() ) {
			$menu_right = get_option( 'exzo_one_page_menu_right' );
		}
	}


	return $menu_left . $items . $menu_right;
}

add_filter( 'wp_nav_menu_items', 'exzo_social_menu_item', 10, 2 );


/*
 *  it display lis of post cat
 */

function exzo_get_list_cats() {
	global $post;
	$categories = get_the_category( $post->ID );

	foreach ( $categories as $category ) {
		?>

        <a class="" href="<?php esc_url( get_category_link( $category->term_id ) ); ?> ">
			<?php echo esc_html( $category->name ); ?> </a>
		<?php
	}
}


/**
 * Add the 'entry-meta__link' class to the output of the_author_posts_link()
 */
function exzo_link( $link ) {
	return str_replace( 'rel="author"', 'rel="author" class="color"', $link );
}

add_filter( 'exzo_the_author_posts_link', 'exzo_link' );

add_filter( 'exzo_get_avatar', 'exzo_add_gravatar_class' );

function exzo_add_gravatar_class( $class ) {
	$class = str_replace( "class='avatar", "class='avatar image", $class );
	return $class;
}

function exzo_sale_price() {

	$text = "";


	return $text;
}

function exzo_regular_price() {
	$text = "";

	return $text;
}

/**
 *  return price WC
 * @param bool $arr
 * @return int|mixed|string|void
 */
function exzo_get_formatted_price( $only_sale_price = false ) {
    if(!function_exists('wc_get_price_decimal_separator')) return;
	//get formatted price
	extract( apply_filters( 'wc_price_args', wp_parse_args( array(), array(
		'ex_tax_label' => false,
		'currency' => '',
		'decimal_separator' => wc_get_price_decimal_separator(),
		'thousand_separator' => wc_get_price_thousand_separator(),
		'decimals' => wc_get_price_decimals(),
		'price_format' => get_woocommerce_price_format()
	) ) ) );
	$price = exzo_get_current_price_product( get_the_ID(), $only_sale_price );
	if ( $only_sale_price && !$price ) {
		return false;

	}
	/**
	 * get fert variable price
	 */
	$_pf = new WC_Product_Factory();
	$_product = $_pf->get_product( get_the_ID() );

	if ( $_product && $_product->is_type( 'variable' ) ) {


		$prices = array( $_product->get_variation_price( 'min', true ), $_product->get_variation_price( 'max', true ) );
		$price = $prices[0] !== $prices[1] ? sprintf( esc_html__( '%1$s', 'exzo' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );

		// Sale Price
		$prices = array(
			$_product->get_variation_regular_price( 'min', true ),
			$_product->get_variation_regular_price( 'max', true )
		);
		sort( $prices );
		$saleprice = $prices[0] !== $prices[1] ? sprintf( esc_html__( '%1$s', 'exzo' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );

		if ( $price !== $saleprice ) {
			$price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>';
		}
		if(( $suffix = get_option( 'woocommerce_price_display_suffix' ) ) && wc_tax_enabled() ) {
			$price .= ' '.$suffix;
        }

		return $price;
	}


	$negative = $price < 0;
	$price = apply_filters( 'raw_woocommerce_price', floatval( $negative ? $price * - 1 : $price ) );
	$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );

	if ( apply_filters( 'woocommerce_price_trim_zeros', false ) && $decimals > 0 ) {
		$price = wc_trim_zeros( $price );
	}


	$formatted_price = ( $negative ? '-' : '' ) . sprintf( $price_format, get_woocommerce_currency_symbol( $currency ), $price );

	if(( $suffix = get_option( 'woocommerce_price_display_suffix' ) ) && wc_tax_enabled() ) {
		$formatted_price .= ' '.$suffix;
	}
	return wp_kses_post( $formatted_price );
}

/**
 * @param $product_id
 * @return int|mixed|string
 */
function exzo_get_current_price_product( $product_id, $only_sale_price = false ) {
	$sale_cost = get_post_meta( $product_id, "_sale_price", true );
	$base_price = get_post_meta( $product_id, "_regular_price", true );

	$_product = wc_get_product( $product_id );


	$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
	$display_price = $tax_display_mode == 'incl' ? $_product->get_price_including_tax() : $_product->get_price_excluding_tax();
	$display_regular_price = $tax_display_mode == 'incl' ? $_product->get_price_including_tax( 1, $_product->get_regular_price() ) : $_product->get_price_excluding_tax( 1, $_product->get_regular_price() );
	$display_sale_price = $tax_display_mode == 'incl' ? $_product->get_price_including_tax( 1, $_product->get_sale_price() ) : $_product->get_price_excluding_tax( 1, $_product->get_sale_price() );

	$base_price = $display_regular_price;
	$sale_cost = $display_sale_price;


	//return $display_sale_price;


	if ( $only_sale_price   ) {
		if( $sale_cost == $base_price){
			return false;
		}
		//return $sale_cost;
		return $base_price;
	}
	if ( $sale_cost < $base_price ) {
		return $sale_cost;
	}
	return  $sale_cost;
}

// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'exzo_dequeue_styles' );

function exzo_dequeue_styles( $enqueue_styles ) {
	unset( $enqueue_styles['woocommerce-general'] );    // Remove the gloss
	unset( $enqueue_styles['woocommerce-layout'] );        // Remove the layout
	unset( $enqueue_styles['woocommerce-smallscreen'] );    // Remove the smallscreen optimisation
	return $enqueue_styles;
}

/* * *
 * @return string
 */

function exzo_password_form_post() {

	ob_start();
	?>
    <form action="<?php echo esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ); ?>" method="post">
        <h6> <?php esc_html_e( 'To view this protected post, enter the password below:', 'exzo' ); ?> </h6>
        <div class="row">
            <div class="col-sm-6">
                <input class="simple-input" type="password" name="post_password"
                       placeholder="<?php esc_html_e( 'Enter password', 'exzo' ); ?>"/>
            </div>
            <div class="col-sm-6">
                <button class="button size-2 style-3 " type="submit"><span class="button-wrapper"><span
                                class="icon"><img                                    src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/icon-4.png"
                                    alt=""/></span> <span                                class="text"><?php echo esc_html__( 'submit', 'exzo' ); ?></span> </span>                </button>
            </div>
        </div>
    </form>
	<?php
	return ob_get_clean();
}

add_filter( 'the_password_form', 'exzo_password_form_post' );


add_filter( "redux/exzo_options/field/class/slides", "exzo_overload_edd_license_field_path" );

/**
 * @return string
 */
function exzo_overload_edd_license_field_path() {
	return get_template_directory() . '/sample/slides/field_slides.php';
}

/**
 * @return mixed
 */
function get_exzo_settings() {
	global $exzo_settings;
	return $exzo_settings;
}


if ( !function_exists( 'exzo_page_title' ) ) {
	/**
	 * @param bool $display
	 * @param string $single_posts
	 * @param string $vacancies_posts
	 * @return string
	 */
	function exzo_page_title( $display = true, $single_posts = '', $vacancies_posts = '' ) {
		global $wp_locale;

		$m = get_query_var( 'm' );
		$year = get_query_var( 'year' );
		$monthnum = get_query_var( 'monthnum' );
		$day = get_query_var( 'day' );
		$search = get_query_var( 's' );
		$title = '';

		// filter
		if ( isset( $_GET['tax'] ) && isset( $_GET['term'] ) ) {
			$term = get_term_by( 'slug', sanitize_text_field( $_GET['term'] ), sanitize_text_field( $_GET['tax'] ) );
			return esc_html( $term->name );

		}


		// If there is a post
		if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) || is_front_page() ) {
			$title = single_post_title( '', false );
		}

		if ( is_home() ) {
			if ( !get_option( 'page_for_posts' ) ) {
				$title = $single_posts;
			}
		}

		// If there's a post type archive
		if ( is_post_type_archive() ) {
			$post_type = get_query_var( 'post_type' );
			if ( is_array( $post_type ) ) {
				$post_type = reset( $post_type );
			}
			$post_type_object = get_post_type_object( $post_type );
			if ( !$post_type_object->has_archive ) {
				$title = post_type_archive_title( '', false );
			}
		}

		// If there's a category or tag
		if ( is_category() || is_tag() ) {
			$title = single_term_title( '', false );
		}

		// If there's a taxonomy
		if ( is_tax() ) {
			$term = get_queried_object();
			if ( $term ) {
				$tax = get_taxonomy( $term->taxonomy );
				$title = single_term_title( '', false );
			}
		}

		// If there's an author
		if ( is_author() && !is_post_type_archive() ) {
			$author = get_queried_object();
			if ( $author ) {
				$title = $author->display_name;
			}
		}

		// Post type archives with has_archive should override terms.
		if ( is_post_type_archive() && $post_type_object->has_archive ) {
			if ( function_exists( 'is_shop' ) && is_shop() ) {
				$title = get_the_title( get_option( 'woocommerce_shop_page_id' ) );
			} else {
				$title = post_type_archive_title( '', false );
			}
		}

		// If there's a month
		if ( is_archive() && !empty( $m ) ) {
			$exzo_year = substr( $m, 0, 4 );
			$exzo_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
			$exzo_day = intval( substr( $m, 6, 2 ) );
			$title = $exzo_year . ( $exzo_month ? $exzo_month : '' ) . ( $exzo_day ? $exzo_day : '' );
		}

		// If there's a year
		if ( is_archive() && !empty( $year ) ) {
			$title = $year;
			if ( !empty( $monthnum ) ) {
				$title .= ' ' . $wp_locale->get_month( $monthnum );
			}
			if ( !empty( $day ) ) {
				$title .= ' ' . zeroise( $day, 2 );
			}
		}

		// If it's a search
		if ( is_search() ) {
			/* translators: 1: separator, 2: search phrase */
			$title = esc_html__( 'Search Results', 'exzo' );
		}

		// If it's a 404 page
		if ( is_404() ) {
			$title = esc_html__( 'Page not found', 'exzo' );
		}

		if ( $display ) {
			echo esc_html( $title );
		} else {
			return esc_html( $title );
		}
	}
}


/**
 * get post date
 */
function exzo_get_post_time() {

	if (  get_option( 'date_format' ) == 'j M / y' ) {

		?>
        <span><?php echo esc_html( get_the_date( 'j ' ) ); ?></span>
		<?php echo esc_html( get_the_date( 'M / y ' ) );

	} else {
		echo esc_html( get_the_date() );
	}
}


add_filter('exzo_get_avatar','exzo_avatar_class');
function exzo_avatar_class($class) {
$class = str_replace("class='avatar", "class='preview  avatar", $class);
   return $class;
}

add_filter('get_avatar','add_gravatar_class');

function add_gravatar_class($class) {
	$class = str_replace("class='avatar", "class='avatar pic-2", $class);
	return $class;
}


/**
 * Class exzo_top_menu_walker
 */

class exzo_top_menu_walker extends Walker_Nav_Menu {
	public $title, $count, $menu_id;
	private $mega_menu_flag = false;
	private $mega_menu_termid = false;
	private $curItem;
	private $megamenu = 0;

	function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
		$id_field = $this->db_fields['id'];
		if ( is_object( $args[0] ) ) {
			$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
		}

		return parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
	}

	/**
	 * add classes to ul dropdown-menus
	 *
	 * @param $output
	 * @param int $depth
	 * @param array $args
	 */
	function start_lvl( &$output, $depth = 0, $args = array() ) {
		$indent = str_repeat( "\t", $depth );

		//start mega menu ul
		if ( $this->mega_menu_flag == true && $depth == 0 ) {
			$output .= "\n$indent <div class=\"menu-toggle\"></div><div data-menuflaglvl1='{$this->mega_menu_flag}' data-depth='{$depth}'
            class=\"megamenu\">
                              
                                    <div class=\"links \">\n";
		} elseif ($depth == 0 ){
            //  standard menu
            $output .= "\n$indent<div class=\"menu-toggle\"></div><ul data-menuflaglvl1='{$this->mega_menu_flag}' data-depth='{$depth}' class=\"dropmenu\">\n";

        }
		else {
			//  standard menu
			$output .= "\n$indent<ul data-menuflaglvl1='{$this->mega_menu_flag}' data-depth='{$depth}' class=\"dropmenu\">\n";
		}
	}

	public function end_lvl( &$output, $depth = 0, $args = array() ) {
		$indent = str_repeat( "\t", $depth );
		ob_start();
		$n = ob_get_clean();
		//end mega menu li
		if ( $this->mega_menu_flag == true && $depth == 0 ) {
			$output .= "$indent  $n </div>
   <div class=\"content\">
            <div class=\"row nopadding\"> <div class=\"col-xs-6\">
                                        " . do_shortcode( get_post_meta( $this->mega_menu_termid, 'menu-item-megamenu_col1', 1 ) ) . "
                                  
                                  </div>
                                   <div class=\"col-xs-6\">
                                       " . do_shortcode( get_post_meta( $this->mega_menu_termid, 'menu-item-megamenu_col2', 1 ) ) . "
                                  
                                  </div> ". do_shortcode( get_post_meta( $this->mega_menu_termid, 'menu-item-megamenu_col3', 1 ) ) . "
       
</div> </div>
        </div>\n";
		} else {
			$output .= "$indent</ul>\n";
		}
	}

	public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {

		$indent    = ( $depth ) ? str_repeat( "\t", $depth ) : '';
		$item_id   = esc_attr( $item->ID );
		$classes   = empty( $item->classes ) ? array() : (array) $item->classes;
		$classes[] = 'menu-item-' . $item->ID;
		/**
		 * Filter the CSS class(es) applied to a menu item's list item element.
		 *
		 * @since 3.0.0
		 * @since 4.1.0 The `$depth` parameter was added.
		 *
		 * @param array $classes The CSS classes that are applied to the menu item's `<li>` element.
		 * @param object $item The current menu item.
		 * @param array $args An array of {@see wp_nav_menu()} arguments.
		 * @param int $depth Depth of menu item. Used for padding.
		 */
		$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
		$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . ' detph' . $depth . '"' : '';


				/**
		 * Filter the ID applied to a menu item's list item element.
		 *
		 * @since 3.0.1
		 * @since 4.1.0 The `$depth` parameter was added.
		 *
		 * @param string $menu_id The ID that is applied to the menu item's `<li>` element.
		 * @param object $item The current menu item.
		 * @param array $args An array of {@see wp_nav_menu()} arguments.
		 * @param int $depth Depth of menu item. Used for padding.
		 */
		$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
		$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
		if ( get_post_meta( $item_id, 'menu-item-megamenu', true ) != 'on' && $depth == 0 ) {
			$this->mega_menu_flag = false;
		}
		if ( get_post_meta( $item_id, 'menu-item-megamenu', true ) == 'on' ) {
			$output .= $indent . '<li' . $id . " class='megamenu-wrapper'" . '>';
			$this->mega_menu_flag = true;
			$this->mega_menu_termid = $item_id;

		} else {
			if ( $this->mega_menu_flag == true && get_post_meta( $item->menu_item_parent, 'menu-item-megamenu', true ) == 'on' ) {
				$output .= $indent ;

			} else {

				$output .= $indent . '<li data-menuflag2="' . $this->mega_menu_flag . '" data-parent="' . $item->menu_item_parent . '"' . $id . $class_names . '>';
			}
		}
		$atts           = array();
		$atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
		$atts['target'] = ! empty( $item->target ) ? $item->target : '';
		$atts['rel']    = ! empty( $item->xfn ) ? $item->xfn : '';
		$atts['href']   = ! empty( $item->url ) ? $item->url : '';
		/**
		 * Filter the HTML attributes applied to a menu item's anchor element.
		 *
		 * @since 3.6.0
		 * @since 4.1.0 The `$depth` parameter was added.
		 *
		 * @param array $atts {
		 *     The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
		 *
		 * @type string $title Title attribute.
		 * @type string $target Target attribute.
		 * @type string $rel The rel attribute.
		 * @type string $href The href attribute.
		 * }
		 *
		 * @param object $item The current menu item.
		 * @param array $args An array of {@see wp_nav_menu()} arguments.
		 * @param int $depth Depth of menu item. Used for padding.
		 */
		$atts       = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
		$attributes = '';
		foreach ( $atts as $attr => $value ) {
			if ( ! empty( $value ) ) {
				$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
				$attributes .= ' ' . $attr . '="' . $value . '"';
			}
		}

		$item_output = '';
		if ( $this->mega_menu_flag == true && get_post_meta( $item->menu_item_parent, 'menu-item-megamenu', true ) == 'on' ) {


			$item_output .= '<a' . $attributes . '>';
			/** This filter is documented in wp-includes/post-template.php */
			$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
			$item_output .= '</a>';
		} else {
			$item_output .= '<a' . $attributes . '>';
			/** This filter is documented in wp-includes/post-template.php */
			$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
			$item_output .= '</a>';

		}
		/**
		 * Filter a menu item's starting output.
		 *
		 * The menu item's starting output only includes `$args->before`, the opening `<a>`,
		 * the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is
		 * no filter for modifying the opening and closing `<li>` for a menu item.
		 *
		 * @since 3.0.0
		 *
		 * @param string $item_output The menu item's starting HTML output.
		 * @param object $item Menu item data object.
		 * @param int $depth Depth of menu item. Used for padding.
		 * @param array $args An array of {@see wp_nav_menu()} arguments.
		 */

		$output .= $item_output;
	}

	/**
	 * Ends the element output, if needed.
	 *
	 * @see Walker::end_el()
	 *
	 * @since 3.0.0
	 *
	 * @param string $output Passed by reference. Used to append additional content.
	 * @param object $item Page data object. Not used.
	 * @param int $depth Depth of page. Not Used.
	 * @param array $args An array of arguments. @see wp_nav_menu()
	 */
	public function end_el( &$output, $item, $depth = 0, $args = array() ) {
		//colum mega menu
		if ( $this->mega_menu_flag == true && get_post_meta( $item->menu_item_parent, 'menu-item-megamenu', true ) == 'on' ) {
			$output .= "\n";
		} else {
			$output .= "</li>\n";
		}
	}
}


function exzo_comment_shop( $comment, $args, $depth ) {


	?>
    <div class="testimonial-entry">
        <div class="row col-xs-b20">
            <div class="col-xs-8">
				<?php
				ob_start();

				$atts = array(

					'class' => 'preview'
				);


				if ( $args['avatar_size'] != 0 ) echo wp_kses_post(get_avatar( $comment, $args['avatar_size'] , '', '', $atts   ));


				?>


                <div class="heading-description">
                    <div class="h6 col-xs-b5"><?php
						echo wp_kses_post( get_comment_author() );
						?></div>
					<?php
					$rating = get_comment_meta( $comment->comment_ID, 'rating', 1 );
					?>
                    <div class="rate-wrapper align-inline">
						<?php
						exzo_stars2( $rating );
						?>
                    </div>
                </div>
            </div>
            <div class="col-xs-4 text-right">
                <div class="simple-article size-1 grey"><?php
					echo esc_html( get_comment_time( 'H:i ' ) );
					$d = " F j / Y";

					echo esc_html( get_comment_date( $d ) );
					?>
                </div>
            </div>
        </div>
		<?php
		if ( $comment->comment_approved == '0' ):
			?>
            <em class="simple-article size-2 col-xs-b15"><?php
				esc_html_e( 'Your comment is awaiting moderation.', 'exzo' );
				?></em>
            <br/>
			<?php
		endif;
		?>

        <div class="simple-article size-2 col-xs-b15"><?php
			comment_text();
			?>
        </div>

		<?php
		$pros = get_comment_meta( $comment->comment_ID, 'exzo_pros', 1 );
		if ( isset( $pros{1} ) ):
			?>
            <div class="pros">
                <div class="simple-article size-2 col-xs-b15">
					<?php
					echo wp_kses_post( $pros );
					?>


                </div>
            </div>
			<?php
		endif;
		?>

		<?php

		$cons = get_comment_meta( $comment->comment_ID, 'exzo_cons', 1 );
		if ( isset( $cons{1} ) ):
			?>
            <div class="cons">
                <div class="simple-article size-2 col-xs-b25">
					<?php
					echo wp_kses_post( $cons );
					?>
                </div>
            </div>
			<?php
		endif;
		?>
		<?php
		edit_comment_link( esc_html__( '(Edit)', 'exzo' ), '  ', '' );
		?>

    </div>

	<?php
}
//add_filter('nav_menu_css_class' , 'exzo_nav_class' , 10 , 2);

function exzo_nav_class ($classes, $item) {
	if ( in_array( 'current-menu-item', $classes ) ) {
		$classes[] = 'active ';
	}

	if ( in_array( 'current_page_ancestor', $classes ) ) {
		$classes[] = 'active ';
	}


	if ( in_array( 'current-menu-ancestor', $classes ) ) {
		$classes[] = 'active ';
	}
	return $classes;
}



add_filter( 'wp_generate_tag_cloud_data', 'exzo_tag_cloud_data', 10, 1 );

function exzo_tag_cloud_data( $tags_data ) {

	foreach ( $tags_data as $key => $tag ) {

		// get tag count
		$count = $tag [ 'real_count' ];

		// adjust the class based on the size
		if ( $count > 20 ) {
			$tags_data [ $key ] [ 'class' ] .= ' tag x-large';
		} elseif ( $count > 15 ) {
			$tags_data [ $key ] [ 'class' ] .= ' tag large';
		} elseif ( $count > 7 ) {
			$tags_data [ $key ] [ 'class' ] .= ' tag medium';
		} elseif ( $count > 1 ) {
			$tags_data [ $key ] [ 'class' ] .= ' tag small';
		} else {
			$tags_data [ $key ] [ 'class' ] .= ' tag x-small ';
		}
		$tags_data [ $key ] [ 'class' ] .= ' tag ';
	}

	// return adjusted data
	return $tags_data;
}