File: /var/www/html/somosedsa.sumar.com.py/wp-content/plugins/wpdiscuz-widgets/tabs/most-voted.php
<?php if ( ! defined( "ABSPATH" ) ) {
exit();
} ?>
<div id="wpdiscuz-most-voted-comments-box" class="most-voted">
<?php
$get_date_mvdi = self::getDateIntervals( $most_voted_date_interval );
$hide_most_voted_title = apply_filters( 'wpd_widget_hide_most_voted_title', false );
if ( $most_voted_date_interval == "all_time" ) {
$query_date = [];
} elseif ( $most_voted_date_interval == "custom_date" ) {
$query_date = [
"column" => "comment_date",
[
"after" => $most_voted_from_date,
"before" => $most_voted_to_date,
"inclusive" => true
]
];
} else {
$query_date = [
"column" => "comment_date",
[
"after" => $get_date_mvdi["from"],
"inclusive" => true
]
];
}
$all_comms_args = [
"number" => $count_most_voted,
"orderby" => "meta_value_num, comment_date",
"order" => "DESC",
"status" => "approve",
"meta_key" => WpDiscuzConstants::META_KEY_VOTES,
"date_query" => $query_date,
// "caller" => "wpdiscuz_widgets_mv",
];
$all_comms_args = apply_filters("wpdiscuz_widget_most_voted_comments_args", $all_comms_args);
$coms = get_comments( $all_comms_args );
if ( $this->options["wpdiscuz_widget_theme_title_struct"] === 1 ) {
echo $before_title . $title_most_voted . $after_title;
} else {
echo "<h2 class='wpd_widgets_title'> $title_most_voted </h2>";
}
?>
<div class="wpd_widgets_items_wrapper">
<?php
foreach ( $coms as $com ) {
if ( $this->options["wpdiscuz_widget_post_title_cutting"] ) {
$get_post = get_post( $com->comment_post_ID );
$comment_post_title = get_the_title($get_post->ID);
$comment_post_title = wp_trim_words( $comment_post_title, $this->options["wpdiscuz_widgets_post_title_word_count"] );
} else {
$get_post = get_post( $com->comment_post_ID );
$comment_post_title = get_the_title($get_post->ID);
}
$replaced_comment = wpautop( get_comment_excerpt( $com ) );
$replaced_comment = preg_replace( "~\[spoiler.*?\[\/spoiler\]~", "", $replaced_comment );
$user_link = get_author_posts_url( $com->user_id );
$p_link = get_the_permalink( $com->comment_post_ID );
$comm_date = date( $this->widget_date_format, strtotime( $com->comment_date ) );
$comment_vote = get_comment_meta( $com->comment_ID, WpDiscuzConstants::META_KEY_VOTES, true );
$commentLink = get_comment_link( $com );
if ( $this->options["mvc_displaying_style"] === "votes_style" ) {
?>
<div class="wpdiscuz-widget-comment most-voted like-count-first">
<div class="wpd-widget-comment-top">
<div class="wpdiscuz-widget-icon-show-box <?php if ( $this->options["wpdiscuz_widget_icon_circle"] === 1 ) {
echo "icon-circle";
} ?>">
<a href="<?php echo $commentLink; ?>">
<i class="far fa-thumbs-up"></i>
</a>
<div class="wpd-widget-comp-count"
title="<?php echo $comment_vote; ?>"><?php echo $wpdiscuz->helper->getNumber( $comment_vote ); ?></div>
</div>
<div class="wpdiscuz-widget-comment-content">
<?php if ( ! $hide_most_voted_title ) { ?>
<a href="<?php echo $commentLink; ?>">
<p class="wpdiscuz-widget-comment-title"><?php echo $comment_post_title; ?></p>
</a>
<?php } ?>
<div class="wpdiscuz-widget-comment-exc">
<?php echo $hide_most_voted_title ? '<a href="' . $commentLink . '">' : ''; ?>
<?php echo $replaced_comment; ?>
<?php echo $hide_most_voted_title ? '</a>' : ''; ?>
</div>
</div>
</div>
<?php if ( apply_filters( "wpdiscuz_widget_meta_info", false ) ): ?>
<div class="wpd-widget-comment-bottom">
<ul class="wpdiscuz-widget-about-comment-right">
<li title="Comment Author: <?php echo $this->getCommentAuthor( $com ); ?>"><i
class="fas fa-user"></i> <?php echo $this->getCommentAuthor( $com ); ?></li>
<li title="Comment Date: <?php echo $comm_date; ?>"><i class="fas fa-calendar-alt"></i> <?php echo $wpdiscuz->options->general["simpleCommentDate"] ? $comm_date : $wpdiscuz->helper->dateDiff( $com->comment_date_gmt ); ?>
</li>
</ul>
</div>
<?php endif; ?>
<hr class='delim'>
</div>
<?php
} elseif ( $this->options["mvc_displaying_style"] === "avatar_style" ) {
if ( $us_id = $com->user_id > 0 ) {
$user_post_count = count_user_posts( $com->user_id );
} else {
$user_post_count = - 1;
}
?>
<div class="wpdiscuz-widget-comment most-voted avatar-first">
<div class="wpd-widget-comment-top">
<div class="wpdiscuz-widget-avatar-box">
<?php if ( $user_post_count > 0 ) { ?>
<a href="<?php echo $user_link; ?>"
class="avatar-blok <?php if ( $this->options["wpdiscuz_widget_icon_circle"] === 1 ) {
echo "icon-circle";
} ?>">
<?php echo get_avatar( $com->comment_author_email, 50, "", "", [
"class" => [
"user_avatar",
"wpdiscuz-widget-author-avatar"
]
] ); ?>
</a>
<?php } else {
?>
<div class="avatar-blok <?php if ( $this->options["wpdiscuz_widget_icon_circle"] === 1 ) {
echo "icon-circle";
} ?>">
<?php echo get_avatar( $com->comment_author_email, 50, "", "", [
"class" => [
"user_avatar",
"wpdiscuz-widget-author-avatar"
]
] ); ?>
</div>
<?php }
?>
<div class="wpdiscuz-widget-comment-votes" style="text-align:center;"
title="<?php echo $comment_vote; ?>"><i
class="far fa-thumbs-up"></i> <?php echo $wpdiscuz->helper->getNumber( $comment_vote ); ?>
</div>
</div>
<div class="wpdiscuz-widget-comment-content">
<a href="<?php echo $commentLink; ?>">
<p class="wpdiscuz-widget-comment-title"><?php echo $comment_post_title; ?></p>
</a>
<div class="wpdiscuz-widget-comment-exc"><?php echo $replaced_comment; ?></div>
</div>
</div>
<?php if ( apply_filters( "wpdiscuz_widget_meta_info", false ) ): ?>
<div class="wpd-widget-comment-bottom">
<ul class="wpdiscuz-widget-about-comment-right">
<li><i class="fas fa-calendar-alt"></i> <?php
echo $wpdiscuz->options->general["simpleCommentDate"] ? $comm_date : $wpdiscuz->helper->dateDiff( $com->comment_date_gmt );
printf( __( " by %s", "wpdiscuz-widgets" ), $this->getCommentAuthor( $com ) );
?>
</li>
</ul>
</div>
<?php endif; ?>
<hr class='delim'>
</div>
<?php
}
}
?>
</div>
</div>