| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/plugins/eltd-core/lib/ |
Upload File : |
<?php
if(!function_exists('eltd_core_get_cpt_shortcode_module_template_part')) {
/**
* Loads module template part.
*
* @param string $shortcode name of the shortcode folder
* @param string $template name of the template to load
* @param string $slug
* @param array $params array of parameters to pass to template
* @param array $additional_params array of additional parameters to pass to template
*
* @return html
*/
function eltd_core_get_cpt_shortcode_module_template_part($shortcode, $template, $slug = '', $params = array(), $additional_params = array()) {
//HTML Content from template
$html = '';
$template_path = ELATED_CORE_CPT_PATH.'/'.$shortcode.'/shortcodes/templates';
$temp = $template_path.'/'.$template;
if(is_array($params) && count($params)) {
extract($params);
}
if(is_array($additional_params) && count($additional_params)) {
extract($additional_params);
}
$template = '';
if (!empty($temp)) {
if (!empty($slug)) {
$template = "{$temp}-{$slug}.php";
if(!file_exists($template)) {
$template = $temp.'.php';
}
} else {
$template = $temp.'.php';
}
}
if ($template) {
ob_start();
include($template);
$html = ob_get_clean();
}
return $html;
}
}
if(!function_exists('eltd_core_get_cpt_single_module_template_part')) {
/**
* Loads module template part.
*
* @param string $cpt_name name of the cpt folder
* @param string $template name of the template to load
* @param string $slug
* @param array $params array of parameters to pass to template
*
* @return html
*/
function eltd_core_get_cpt_single_module_template_part($template, $cpt_name, $slug = '', $params = array()) {
//HTML Content from template
$html = '';
$template_path = ELATED_CORE_CPT_PATH.'/'.$cpt_name;
$temp = $template_path.'/'.$template;
if(is_array($params) && count($params)) {
extract($params);
}
$template = '';
if (!empty($temp)) {
if (!empty($slug)) {
$template = "{$temp}-{$slug}.php";
if(!file_exists($template)) {
$template = $temp.'.php';
}
} else {
$template = $temp.'.php';
}
}
if (!empty($template)) {
ob_start();
include($template);
$html = ob_get_clean();
}
echo trackstore_elated_get_module_part($html);
}
}
if(!function_exists('eltd_core_return_cpt_single_module_template_part')) {
/**
* Loads module template part.
*
* @param string $cpt_name name of the cpt folder
* @param string $template name of the template to load
* @param string $slug
* @param array $params array of parameters to pass to template
*
* @return html
*/
function eltd_core_return_cpt_single_module_template_part($template, $cpt_name, $slug = '', $params = array()) {
//HTML Content from template
$html = '';
$template_path = ELATED_CORE_CPT_PATH.'/'.$cpt_name;
$temp = $template_path.'/'.$template;
if(is_array($params) && count($params)) {
extract($params);
}
$template = '';
if (!empty($temp)) {
if (!empty($slug)) {
$template = "{$temp}-{$slug}.php";
if(!file_exists($template)) {
$template = $temp.'.php';
}
} else {
$template = $temp.'.php';
}
}
if (!empty($template)) {
ob_start();
include($template);
$html = ob_get_clean();
}
return $html;
}
}
if(!function_exists('eltd_core_get_shortcode_module_template_part')) {
/**
* Loads module template part.
*
* @param string $template name of the template to load
* @param string $shortcode name of the shortcode folder
* @param string $slug
* @param array $params array of parameters to pass to template
*
* @return html
*/
function eltd_core_get_shortcode_module_template_part($template, $shortcode, $slug = '', $params = array()) {
//HTML Content from template
$html = '';
$template_path = ELATED_CORE_SHORTCODES_PATH.'/'.$shortcode;
$temp = $template_path.'/'.$template;
if(is_array($params) && count($params)) {
extract($params);
}
$template = '';
if (!empty($temp)) {
if (!empty($slug)) {
$template = "{$temp}-{$slug}.php";
if(!file_exists($template)) {
$template = $temp.'.php';
}
} else {
$template = $temp.'.php';
}
}
if ($template) {
ob_start();
include($template);
$html = ob_get_clean();
}
return $html;
}
}
if( ! function_exists( 'eltd_core_ajax_status' ) ) {
/**
* Function that return status from ajax functions
*/
function eltd_core_ajax_status($status, $message, $data = NULL) {
$response = array (
'status' => $status,
'message' => $message,
'data' => $data
);
$output = json_encode($response);
exit($output);
}
}
if(!function_exists('trackstore_elated_add_user_custom_fields')) {
/**
* Function creates custom social fields for users
*
* return $user_contact
*/
function trackstore_elated_add_user_custom_fields($user_contact) {
/**
* Function that add custom user fields
**/
$user_contact['facebook'] = esc_html__('Facebook', 'eltd-core');
$user_contact['twitter'] = esc_html__('Twitter', 'eltd-core');
$user_contact['linkedin'] = esc_html__('Linkedin', 'eltd-core');
$user_contact['instagram'] = esc_html__('Instagram', 'eltd-core');
$user_contact['pinterest'] = esc_html__('Pinterest', 'eltd-core');
$user_contact['tumblr'] = esc_html__('Tumbrl', 'eltd-core');
$user_contact['googleplus'] = esc_html__('Google Plus', 'eltd-core');
return $user_contact;
}
add_filter('user_contactmethods', 'trackstore_elated_add_user_custom_fields');
}
if ( ! function_exists( 'eltd_core_set_open_graph_meta' ) ) {
/*
* Function that echoes open graph meta tags if enabled
*/
function eltd_core_set_open_graph_meta() {
if ( trackstore_elated_option_get_value( 'enable_open_graph' ) === 'yes' ) {
// get the id
$id = get_queried_object_id();
// default type is article, override it with product if page is woo single product
$type = 'article';
$description = '';
// check if page is generic wp page w/o page id
if ( trackstore_elated_is_default_wp_template() ) {
$id = 0;
}
// check if page is woocommerce shop page
if ( trackstore_elated_is_woocommerce_installed() && ( function_exists( 'is_shop' ) && is_shop() ) ) {
$shop_page_id = get_option( 'woocommerce_shop_page_id' );
if ( ! empty( $shop_page_id ) ) {
$id = $shop_page_id;
// set flag
$description = 'woocommerce-shop';
}
}
if ( function_exists( 'is_product' ) && is_product() ) {
$type = 'product';
}
// if id exist use wp template tags
if ( ! empty( $id ) ) {
$url = get_permalink( $id );
$title = get_the_title( $id );
// apply bloginfo description to woocommerce shop page instead of first product item description
if ( $description === 'woocommerce-shop' ) {
$description = get_bloginfo( 'description' );
} elseif (get_post_field( 'post_excerpt', $id ) !== '') {
$description = strip_tags( apply_filters( 'the_excerpt', get_post_field( 'post_excerpt', $id ) ) );
} else {
$description = get_bloginfo( 'description' );
}
// has featured image
if ( get_post_thumbnail_id( $id ) !== '' ) {
$image = wp_get_attachment_url( get_post_thumbnail_id( $id ) );
} else {
$image = trackstore_elated_option_get_value( 'open_graph_image' );
}
} else {
global $wp;
$url = esc_url( home_url( add_query_arg( array(), $wp->request ) ) );
$title = get_bloginfo( 'name' );
$description = get_bloginfo( 'description' );
$image = trackstore_elated_option_get_value( 'open_graph_image' );
}
?>
<meta property="og:url" content="<?php echo esc_url( $url ); ?>"/>
<meta property="og:type" content="<?php echo esc_html( $type ); ?>"/>
<meta property="og:title" content="<?php echo esc_html( $title ); ?>"/>
<meta property="og:description" content="<?php echo esc_html( $description ); ?>"/>
<meta property="og:image" content="<?php echo esc_url( $image ); ?>"/>
<?php }
}
add_action( 'trackstore_elated_header_meta', 'eltd_core_set_open_graph_meta' );
}
/* Function for adding custom meta boxes hooked to default action */
if ( class_exists( 'WP_Block_Type' ) && defined( 'ELATED_ROOT' ) ) {
add_action( 'admin_head', 'trackstore_elated_meta_box_add' );
} else {
add_action( 'add_meta_boxes', 'trackstore_elated_meta_box_add' );
}
if ( ! function_exists( 'trackstore_elated_create_meta_box_handler' ) ) {
function trackstore_elated_create_meta_box_handler( $box, $key, $screen ) {
add_meta_box(
'eltd-meta-box-' . $key,
$box->title,
'trackstore_elated_render_meta_box',
$screen,
'advanced',
'high',
array( 'box' => $box )
);
}
}