| Server IP : 14.225.204.176 / Your IP : 216.73.216.252 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/ezine/wp-content/themes/ezine/ |
Upload File : |
<?php
/*
* Template Name: Page Builder
*/
$ezine_is_pw_req = post_password_required();
get_header();
$ezine_duplication_prevented_posts = array();
$ezine_pb_data = get_post_meta($post->ID, ezine_get_pb_id(), true);
if( is_array($ezine_pb_data) ) {
$ezine_modules = array_values(current($ezine_pb_data)['modules']);
}
ezine_breadcrumb();
if (!$ezine_is_pw_req) {
ezine_featured_img();
ezine_featured_posts();
}
?>
<div class="<?php echo esc_attr(ezine_single_class()); ?>">
<div class="<?php echo esc_attr(ezine_row_class()); ?>">
<main id="main" class="<?php echo esc_attr(ezine_main_class()); ?>">
<?php if (have_posts()):
while (have_posts()): the_post();
$ezine_post_content = get_the_content();
$ezine_show_content = (!ezine_is_empty($ezine_post_content) && ezine_get_option('show_content') == 'true');
echo $ezine_show_content ? '<article id="post-' . intval(get_the_ID()) . '" class="' . esc_attr(join(' ', get_post_class())) . '" role="article">' : '';
ezine_featured_img(); ?>
<?php if ($ezine_show_content): ?>
<section class="post-content">
<?php
echo $ezine_post_content;
if (!$ezine_is_pw_req) {
wp_link_pages(array(
'before' => '<div class="pagination"><span class="page-numbers title">' . esc_html__('Pages:', 'ezine') . '</span>',
'after' => '</div>',
'pagelink' => '%'
));
}
?>
</section><!-- .post-content -->
<?php endif;
echo $ezine_show_content ? '</article>' : '';
endwhile;
endif;
if (is_array($ezine_modules) && !$ezine_is_pw_req) {
$ezine_modules = array_values($ezine_modules);
/*
* Display buttons only in the last module that has pagination buttons.
* "Infinite Scroll" can only be displayed if it is in the last module.
*/
foreach ($ezine_modules as $k => $v) {
if (!array_key_exists('pagination', $v) || empty($v['pagination'])) {
$ezine_modules[$k]['pagination'] = $v['pagination'] = 'none';
}
if ($k < (count($ezine_modules) - 1) && $v['pagination'] == 'infinite') {
$ezine_modules[$k]['pagination'] = 'none';
}
if (in_array($v['module_layout'], array('a', 'b', 'e', 'f', 'g', 'l', 'mm', 'lreal', 'woo1', 'woo2'))
&& !in_array($v['pagination'], array('numeric', 'nextprev'))) {
$ezine_modules[$k]['pagination'] = 'none';
}
if ($v['module_layout'] == 'lreal' || $v['module_layout'] == 'mm' || $v['module_layout'] == 'woo1' || $v['module_layout'] == 'woo2') {
$ezine_modules[$k]['pagination'] = $v['pagination'];
}
}
foreach ($ezine_modules as $k => $v) {
if (isset($ezine_modules[$k + 1]) && $ezine_modules[$k + 1]['pagination'] != 'none') {
$ezine_modules[$k]['pagination'] = 'none';
}
}
foreach ($ezine_modules as $k => $ezine_mod) {
$ezine_mod_header_classes = array('box-header');
$ezine_prevent_duplication = array_key_exists('prevent_duplication', $ezine_mod) ? $ezine_mod['prevent_duplication'] : 'true';
/*
* Module Title
*/
$ezine_mod_header = '';
if (!empty($ezine_mod['title'])) {
if(empty($ezine_mod['filter_category'])) {
$ezine_mod_header .= '<h2 class="title">' . esc_html($ezine_mod['title']) . '</h2>';
$ezine_mod_header_classes[] = 'has-title';
} else {
$cat = current($ezine_mod['filter_category']);
$category_link = get_category_link( $cat );
$ezine_mod_header .= '<h2 class="title">'. "<a href='". esc_url( $category_link ) ."'>". esc_html($ezine_mod['title']) . '</a></h2>';
$ezine_mod_header_classes[] = 'has-title';
}
}
/*
* Module Tabs
*/
if ($ezine_mod['module_layout'] != 'l' && $ezine_mod['module_layout'] != 'woo2' && $ezine_mod['add_tabs'] == 'true') {
if ($ezine_mod['tab_style'] == 'b') {
$ezine_mod_header_classes[] = 'has-tabs';
?>
<script>
(function ($) {
'use strict';
setTimeout(function () {
<?php
if($ezine_mod['tab_type'] == 't1') {
$t1_id = 'nt1-'.rand(0, 1000000);
$ezine_mod_header .= '<div class="'.$t1_id.' new-tab btn-group btn-group-items-' . count($ezine_mod['filter_category']) . '" role="group"></div>';
?>
$('.<?php echo $t1_id; ?>').html('<div class="m-head<?php if ($ezine_mod['tab_style_b'] == 1) {
echo ' mh-2';
} ?>"> <span class="mh-bar"><i class="fa fa-bars"></i></span> <div> <h4><?php echo $ezine_mod["tab_title"]; ?></h4> <ul class="ulfix"> <li class="active-ti"><span class="t-item btn active" data-catid="237489234">All</span></li> <?php $count = 0; foreach($ezine_mod["filter_category"] as $value) { if ($count == 4) {
break;
} ?> <li><span class="t-item btn" data-catid="<?php echo $value; ?>"><?php echo get_cat_name($value); ?></span></li> <?php $count++; } $count = 0; foreach($ezine_mod["filter_category"] as $value) { if($count >= 4) { ?> <li class="only-m"><span class="t-item btn" data-catid="<?php echo $value; ?>"><?php echo get_cat_name($value); ?></span></li> <?php } $count++; } if(count($ezine_mod["filter_category"]) > 4) { ?> <li class="drop-ti"> <span class="t-item ti-more"><i class="fa fa-angle-down"></i></span> <ul class="ulfix ti-more-sub"> <?php $count = 0; foreach($ezine_mod["filter_category"] as $value) { if($count >= 4) { ?> <li><span class="t-item btn" data-catid="<?php echo $value; ?>"><?php echo get_cat_name($value); ?></span></li> <?php } $count++; } ?> </ul> </li> <?php } ?> </ul> </div> </div>');
<?php
} elseif($ezine_mod['tab_type'] == 't2') {
$t2_id = 'nt2-'.rand(0, 1000000);
$ezine_mod_header .= '<div class="'.$t2_id.' new-tab btn-group btn-group-items-3" role="group"></div>';
?>
$('.<?php echo $t2_id; ?>').html('<div class="m-head<?php if ($ezine_mod['tab_style_b'] == 1) {
echo ' mh-2';
} ?>"> <span class="mh-bar"><i class="fa fa-bars"></i></span> <div> <h4><?php echo $ezine_mod["tab_title"]; ?></h4> <ul class="ulfix"> <li class="active-ti"><span class="t-item btn active">Most Recent</span></li><li><span class="t-item btn" data-catid="1">Most Commented</span></li><li><span class="t-item btn mw2" data-catid="2">Most Viewed</span></li> </ul> </div> </div>');
<?php } ?>
}, 1);
})(jQuery);
</script>
<?php
} else {
/*
* Category Tabs
*/
if ($ezine_mod['tab_type'] == 't1' && !empty($ezine_mod['filter_category']) && count($ezine_mod['filter_category']) > 1) {
$ezine_filtered_cats = get_categories(array(
'orderby' => 'date',
'hide_empty' => 0,
'include' => implode(',', $ezine_mod['filter_category'])
));
if (!empty($ezine_filtered_cats)) {
$ezine_mod_header_classes[] = 'has-tabs';
$ezine_mod_header .= '<div class="btn-group btn-group-items-' . count($ezine_filtered_cats) . '" role="group">';
foreach ($ezine_filtered_cats as $i => $ezine_cat) {
$ezine_mod_header .= '<button type="button" class="btn btn-default' . ($i == 0 ? ' active' : '') . '" data-catid="' . intval($ezine_cat->term_id) . '">' . esc_html($ezine_cat->name) . '</button>';
}
$ezine_mod_header .= '<button type="button" class="btn-toggle"><span class="fa fa-navicon"></span></button></div>';
}
}
/*
* Statistical Tabs
*/
if ($ezine_mod['tab_type'] == 't2') {
$ezine_mod_header_classes[] = 'has-tabs';
$ezine_mod_header .= '<div class="btn-group btn-group-items-3" role="group">
<button type="button" class="btn btn-default active">' . esc_html__('Most Recent', 'ezine') . '</button>
<button type="button" class="btn btn-default">' . esc_html__('Most Commented', 'ezine') . '</button>
<button type="button" class="btn btn-default">' . esc_html__('Most Viewed', 'ezine') . '</button>
<button type="button" class="btn-toggle"><span class="fa fa-navicon"></span></button>
</div>';
}
}
}
if (!in_array('has-tabs', $ezine_mod_header_classes)) {
$ezine_mod['tab_type'] = 'none';
}
if (!empty($ezine_mod_header)) {
$ezine_mod_header = '<div class="' . esc_attr(implode(' ', $ezine_mod_header_classes)) . '">' . $ezine_mod_header . '</div>';
}
if ($ezine_mod['module_layout'] == 'a') {
$ezine_mod['max_number_of_posts'] = 3;
} else if ($ezine_mod['module_layout'] == 'b') {
$ezine_mod['max_number_of_posts'] = 7;
}
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
if ($ezine_mod['pagination'] == 'none') {
$paged = 1;
}
$ezine_q_params = array(
'posts_per_page' => $ezine_mod['max_number_of_posts'],
'post_type' => $ezine_mod['post_type'],
'post_status' => 'publish',
'ignore_sticky_posts' => false,
'no_found_rows' => false,
'paged' => $paged
);
if($ezine_mod['module_layout'] == 'woo1' || $ezine_mod['module_layout'] == 'woo2') {
$ezine_q_params['post_type'] = 'product';
}
if (is_numeric($ezine_mod['posts_offset'])) {
$ezine_q_params['offset'] = (($paged - 1) * $ezine_mod['max_number_of_posts']) + $ezine_mod['posts_offset'];
}
if ($ezine_mod['tab_type'] != 't1') {
$ezine_q_params['post__not_in'] = $ezine_duplication_prevented_posts;
}
/*
* Filter Posts by Category
*/
if($ezine_mod['module_layout'] != 'woo1' && $ezine_mod['module_layout'] != 'woo2') {
if (!empty($ezine_mod['filter_category'])) {
if ($ezine_mod['module_layout'] != 'l' && $ezine_mod['add_tabs'] == 'true' && $ezine_mod['tab_type'] == 't1') {
$ezine_q_params['category__in'] = $ezine_mod['filter_category'];
} else {
$ezine_cat_in = array_values($ezine_mod['filter_category']);
if ($ezine_mod['tab_type'] == 't1') {
$ezine_cat_in = array($ezine_cat_in[0]);
}
$ezine_q_params['category__in'] = $ezine_cat_in;
}
}
} else {
if (!empty($ezine_mod['filter_category_woo'])) {
$ezine_q_params['tax_query'] = array(
array(
'terms' => array_values($ezine_mod['filter_category_woo']),
'field' => 'term_id',
'taxonomy' => 'product_cat',
)
);
}
}
/*
* Filter Posts by Post IDs
*/
if (!empty($ezine_mod['filter_post'])) {
$ezine_q_params['post__in'] = array_values(array_filter(array_map(function ($v) {
$v = trim($v);
if (!is_numeric($v) || $v <= 0) {
$v = false;
}
return $v;
}, explode(',', $ezine_mod['filter_post'])), function ($v) {
return is_numeric($v);
}));
}
/*
* Filter Posts by Tag Name
*/
if (!empty($ezine_mod['filter_tag'])) {
$ezine_tag_names = array_filter(explode(',', $ezine_mod['filter_tag']));
if (!empty($ezine_tag_names)) {
foreach ($ezine_tag_names as $ezine_tag) {
$ezine_tag_term = get_term_by('name', trim($ezine_tag), 'post_tag');
if ($ezine_tag_term) {
$ezine_q_params['tag__in'][] = $ezine_tag_term->term_id;
}
}
}
}
/*
* Posts Ordering
*/
switch ($ezine_mod['orderby']) {
case 'views':
$ezine_q_params['orderby'] = 'meta_value_num';
$ezine_q_params['meta_key'] = '_ezine_views';
break;
case 'comments':
$ezine_q_params['orderby'] = 'comment_count';
break;
case 'votes':
$ezine_q_params['orderby'] = 'meta_value_num';
$ezine_q_params['meta_key'] = '_ezine_vote_up';
break;
case 'random':
$ezine_q_params['orderby'] = 'rand';
break;
case 'posts':
$ezine_q_params['orderby'] = 'post__in';
break;
default:
$ezine_q_params['orderby'] = 'date';
}
$ezine_q_params['order'] = ($ezine_mod['order'] != 'asc') ? 'DESC' : 'ASC';
if ($ezine_mod['tab_type'] == 't2') {
$ezine_q_params['orderby'] = 'date';
$ezine_q_params['order'] = 'DESC';
}
/* We do not want html module to include wp_query */
if ($ezine_mod['module_layout'] != 'l') {
$ezine_q = new WP_Query($ezine_q_params);
$ezine_async = false;
$ezine_mod_attr_data = array();
if ($ezine_mod['module_layout'] != 'f' || !is_single()) {
$ezine_mod_attr_data['type'] = $ezine_mod['tab_type'] . '_' . $k;
}
if ($ezine_mod['tab_type'] != 't1') {
$ezine_mod_attr_data['post-not'] = implode(',', $ezine_duplication_prevented_posts);
}
if ($ezine_q->have_posts()) {
if ($ezine_mod['tab_type'] != 't1' && $ezine_prevent_duplication == 'true') {
while ($ezine_q->have_posts()) {
$ezine_q->the_post();
$ezine_duplication_prevented_posts[] = get_the_ID();
}
$ezine_q->rewind_posts();
}
} else {
$ezine_mod['module_layout'] = 'none';
}
if ($ezine_mod['module_layout'] == 'g') {
if ($ezine_mod['g_show_overlay_always'] == 'on') {
$ezine_show_overlay = true;
}
if ($ezine_mod['g_is_autoplay'] == 'true') {
$ezine_is_autoplay = true;
}
}
$ezine_mod_post_meta = array();
if (array_key_exists('post_meta_choices', $ezine_mod)) {
$ezine_mod_post_meta = $ezine_mod['post_meta_choices'];
}
} else {
$ezine_content = $ezine_mod['html'];
}
include(locate_template('includes/modules/module-' . $ezine_mod['module_layout'] . '.php'));
if (isset($ezine_q)) {
ezine_pagination($ezine_mod['pagination'], $ezine_q);
}
}
}
?>
</main>
<?php get_sidebar(); ?>
</div><!-- .row -->
</div><!-- .container -->
<?php
get_footer();