| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/themes/glaza/includes/ |
Upload File : |
<?php
/**
* @return bool|int|mixed
* check layout
*/
if ( ! function_exists( 'glaza_check_post_layout' ) ) {
function glaza_check_post_layout() {
$layout = get_post_meta( get_the_ID(), 'glaza_meta_layout', true );
if ( empty( $layout ) || 'default' == $layout ) {
$layout = glaza_get_option( 'single_post_layout' );
//set sticky
if ( is_sticky() ) {
$layout = 4;
}
}
return $layout;
}
}
/**
* @return bool|mixed|string
* single post sidebar
*/
if ( ! function_exists( 'glaza_post_sidebar_name' ) ) {
function glaza_post_sidebar_name() {
$name = get_post_meta( get_the_ID(), 'glaza_meta_sidebar_name', true );
if ( empty( $name ) || 'default' == $name ) {
$name = glaza_get_option( 'single_post_sidebar_name' );
if ( empty( $name ) ) {
$name = 'glaza_sidebar_default';
}
}
return $name;
}
}
/**
* @return bool|mixed|string
* single post sidebar position
*/
if ( ! function_exists( 'glaza_post_sidebar_position' ) ) {
function glaza_post_sidebar_position() {
$position = get_post_meta( get_the_ID(), 'glaza_meta_sidebar_position', true );
if ( empty( $position ) || 'default' == $position ) {
$position = glaza_get_option( 'single_post_sidebar_position' );
if ( empty( $position ) || 'default' == $position ) {
$position = glaza_get_option( 'default_sidebar_position' );
}
}
if ( empty( $position ) ) {
$position = 'right';
}
return $position;
}
}
/**
* @return bool|mixed
* check featured size
*/
if ( ! function_exists( 'glaza_check_post_featured' ) ) {
function glaza_check_post_featured() {
$size = get_post_meta( get_the_ID(), 'glaza_meta_feat_size', true );
if ( empty( $size ) || 'default' == $size ) {
$size = glaza_get_option( 'single_feat_size' );
}
return $size;
}
}
/**
* @return bool|mixed
* check featured size
*/
if ( ! function_exists( 'glaza_check_post_gallery' ) ) {
function glaza_check_post_gallery() {
$layout = get_post_meta( get_the_ID(), 'glaza_meta_gallery_layout', true );
if ( empty( $layout ) || 'default' == $layout ) {
$layout = glaza_get_option( 'single_post_gallery_layout' );
}
return $layout;
}
}
/**
* @return string
* check post format
*/
if ( ! function_exists( 'glaza_check_post_format' ) ) {
function glaza_check_post_format() {
$post_format = get_post_format();
$post_id = get_the_ID();
if ( 'video' == $post_format ) {
$url = get_post_meta( $post_id, 'glaza_meta_video_url', true );
$embed = get_post_meta( $post_id, 'glaza_meta_video_embed', true );
$self_host_video = get_post_meta( $post_id, 'glaza_meta_video_self_hosted', true );
if ( ! empty( $url ) || ! empty( $embed ) || ! empty( $self_host_video ) ) {
return 'video';
} else {
return 'thumbnail';
}
} elseif ( 'audio' == $post_format ) {
$url = get_post_meta( $post_id, 'glaza_meta_audio_url', true );
$embed = get_post_meta( $post_id, 'glaza_meta_audio_embed', true );
$self_host_audio = get_post_meta( $post_id, 'glaza_meta_audio_self_hosted', true );
if ( ! empty( $url ) || ! empty( $embed ) || ! empty( $self_host_audio ) ) {
return 'audio';
} else {
return 'thumbnail';
}
} elseif ( 'gallery' == $post_format ) {
$gallery = get_post_meta( $post_id, 'glaza_meta_gallery_data', false );
if ( ! empty( $gallery ) ) {
return 'gallery';
} else {
return 'thumbnail';
}
} else {
return 'thumbnail';
}
}
}
/**
* @return bool|int|string
* check video autoplay
*/
if ( ! function_exists( 'glaza_check_autoplay' ) ) {
function glaza_check_autoplay() {
$autoplay = get_post_meta( get_the_ID(), 'glaza_meta_video_autoplay', true );
if ( empty( $autoplay ) || 'default' == $autoplay ) {
return glaza_get_option( 'single_post_video_autoplay' );
} else {
if ( 1 == $autoplay ) {
return 'on';
} else {
return 'off';
}
}
}
}
/**
* @return bool|false|mixed|string
* iframe video
*/
if ( ! function_exists( 'glaza_embed_video' ) ) {
function glaza_embed_video() {
if ( 'video' != get_post_format() ) {
return false;
}
$post_id = get_the_ID();
$self_hosted_video_id = get_post_meta( $post_id, 'glaza_meta_video_self_hosted', true );
$auto_play = glaza_check_autoplay();
if ( ! empty( $self_hosted_video_id ) ) {
$wp_version = floatval( get_bloginfo( 'version' ) );
if ( $wp_version < "3.6" ) {
return '<p class="data-error">' . esc_html__( 'Please update WordPress to the latest version to display this video.', 'glaza' ) . '</p>';
}
$self_hosted_video_url = wp_get_attachment_url( $self_hosted_video_id );
$params = array(
'src' => $self_hosted_video_url,
'width' => 740,
'height' => 415,
'autoplay' => $auto_play
);
return wp_video_shortcode( $params );
} else {
$params = array(
'width' => 740,
'height' => 415
);
$video_url = get_post_meta( $post_id, 'glaza_meta_video_url', true );
$embed = wp_oembed_get( $video_url, $params );
if ( ! empty( $embed ) ) {
return $embed;
} else {
$embed = get_post_meta( $post_id, 'glaza_meta_video_embed', true );
if ( ! empty( $embed ) ) {
return $embed;
} else {
return false;
}
}
}
}
}
/**
* @return bool|false|mixed|string
* audio iframe
*/
if ( ! function_exists( 'glaza_embed_audio' ) ) {
function glaza_embed_audio() {
if ( 'audio' != get_post_format() ) {
return false;
}
$post_id = get_the_ID();
$self_hosted_audio_id = get_post_meta( $post_id, 'glaza_meta_audio_self_hosted', true );
if ( ! empty( $self_hosted_audio_id ) ) {
$wp_version = floatval( get_bloginfo( 'version' ) );
if ( $wp_version < "3.6" ) {
return '<p class="ruby-error">' . esc_html__( 'Please update WordPress to the latest version to display this audio.', 'glaza' ) . '</p>';
}
$self_hosted_audio_url = wp_get_attachment_url( $self_hosted_audio_id );
$params = array(
'src' => $self_hosted_audio_url,
);
return wp_audio_shortcode( $params );
} else {
$audio_url = get_post_meta( $post_id, 'glaza_meta_audio_url', true );
$embed = wp_oembed_get( $audio_url, array( 'height' => 400, 'width' => 900 ) );
if ( ! empty( $embed ) ) {
return $embed;
} else {
$embed = get_post_meta( $post_id, 'glaza_meta_audio_embed', true );
if ( ! empty( $embed ) ) {
return $embed;
} else {
return false;
}
}
}
}
}
/**
* @return bool|mixed
* shop the post layout
*/
if ( ! function_exists( 'glaza_single_shop_layout' ) ) {
function glaza_single_shop_layout() {
$layout = get_post_meta( get_the_ID(), 'glaza_meta_shop_layout', true );
if ( empty( $layout ) || 'default' == $layout ) {
$layout = glaza_get_option( 'single_post_shop_layout' );
}
if ( empty( $layout ) ) {
$layout = 4;
}
return $layout;
}
}
/**
* @return bool|mixed|string
* shop the post style
*/
if ( ! function_exists( 'glaza_single_shop_style' ) ) {
function glaza_single_shop_style() {
$style = get_post_meta( get_the_ID(), 'glaza_meta_shop_style', true );
if ( empty( $style ) || 'default' == $style ) {
$style = glaza_get_option( 'single_post_shop_style' );
}
if ( empty( $style ) ) {
$style = 'light';
}
return $style;
}
}
/**
* @return bool|mixed|string
* shop the post position
*/
if ( ! function_exists( 'glaza_single_shop_position' ) ) {
function glaza_single_shop_position() {
$layout = get_post_meta( get_the_ID(), 'glaza_meta_shop_position', true );
if ( empty( $layout ) || 'default' == $layout ) {
$layout = glaza_get_option( 'single_post_shop_position' );
}
if ( empty( $layout ) ) {
$layout = 'top';
}
return $layout;
}
}
/**
* @param string $post_id
* @param int $paged
*
* @return mixed
* get related posts
*/
if ( ! function_exists( 'glaza_related_get' ) ) {
function glaza_related_get( $post_id = '', $paged = 1 ) {
$where = glaza_get_option( 'single_post_box_related_where' );
$number_of_post = glaza_get_option( 'single_post_box_related_num' );
if ( empty( $post_id ) ) {
$post_id = get_the_ID();
}
$data_cat = get_the_category( $post_id );
$data_tag = get_the_tags( $post_id );
//set query
$param = array();
$param['category_ids'] = '';
$param['tags'] = '';
$param['where'] = $where;
$param['posts_per_page'] = intval( $number_of_post );
if ( empty( $post_id ) ) {
$param['post_not_in'] = get_the_ID();
} else {
$param['post_not_in'] = $post_id;
}
if ( ! empty( $data_cat ) ) {
$cat_id = array();
foreach ( $data_cat as $category ) {
$cat_id[] = $category->term_id;
}
$param['category_ids'] = implode( ',', $cat_id );
}
if ( ! empty( $data_tag ) ) {
$tag_name = array();
foreach ( $data_tag as $tag ) {
$tag_name[] = $tag->slug;
}
$param['tags'] = implode( ',', $tag_name );
}
$data_query = glaza_query_related( $param, $paged );
return $data_query;
}
}
/**
* @return bool
* check post review
*/
if ( ! function_exists( 'glaza_review_check' ) ) {
function glaza_review_check() {
$total_score = get_post_meta( get_the_ID(), 'glaza_as', true );
$enable_review = get_post_meta( get_the_ID(), 'glaza_meta_review_enable', true );
if ( ! empty( $total_score ) && ! empty( $enable_review ) ) {
return $total_score;
} else {
return false;
}
}
}
if ( ! function_exists( 'glaza_review_position' ) ) {
function glaza_review_position() {
$position = get_post_meta( get_the_ID(), 'glaza_meta_review_position', true );
if ( empty( $position ) || 'default' == $position ) {
$position = glaza_get_option( 'single_review_box_position' );
}
return $position;
}
}