function hocwp_theme_translation_comments_list_callback($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $comment_id = $comment->comment_ID; $style = isset($args['style']) ? $args['style'] : 'ol'; $avatar_size = isset($args['avatar_size']) ? absint($args['avatar_size']) : 64; $avatar_size = apply_filters('hocwp_comment_avatar_size', $avatar_size); $max_depth = isset($args['max_depth']) ? absint($args['max_depth']) : ''; $comment_permalink = get_comment_link($comment); if ('div' == $style) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } $comment_date = get_comment_date('Y-m-d H:i:s', $comment_id); $comment_author = '<div class="comment-author vcard">' . get_avatar($comment, $avatar_size) . '<b class="fn">' . get_comment_author_link() . '</b> <span class="says">nói:</span></div>'; $comment_metadata = '<div class="comment-metadata"><a href="' . $comment_permalink . '"><time datetime="' . get_comment_time('c') . '">' . hocwp_human_time_diff_to_now($comment_date) . ' ' . 'trước' . '</time></a> <a class="comment-edit-link" href="' . get_edit_comment_link($comment_id) . '">(' . 'Sửa' . ')</a></div>'; if ($comment->comment_approved == '0') { $comment_metadata .= '<p class="comment-awaiting-moderation">' . 'Bình luận của bạn đang được chờ để xét duyệt.' . '</p>'; } $footer = new HOCWP_HTML('footer'); $footer->set_class('comment-meta'); $footer->set_text($comment_author . $comment_metadata); $comment_text = get_comment_text($comment_id); $comment_text = apply_filters('comment_text', $comment_text, $comment); $comment_content = '<div class="comment-content">' . $comment_text . '</div>'; $reply = '<div class="reply comment-tools">'; $reply .= get_comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $max_depth))); $comment_tools_enabled = apply_filters('hocwp_comment_tools_enabled', true); if ($comment_tools_enabled) { $class = 'comment-like comment-likes'; $session_comment_liked_key = 'comment_' . $comment_id . '_likes'; $liked = intval(isset($_SESSION[$session_comment_liked_key]) ? $_SESSION[$session_comment_liked_key] : ''); if ($liked == 1) { hocwp_add_string_with_space_before($class, 'disabled'); } $a = new HOCWP_HTML('a'); $a->set_class($class); $a->set_attribute('href', 'javascript:;'); $a->set_attribute('data-session-likes-key', $session_comment_liked_key); $likes = hocwp_get_comment_likes($comment_id); $a->set_attribute('data-likes', $likes); $a->set_text('<span class="text">' . 'Thích' . '</span> <i class="fa fa-thumbs-o-up"></i><span class="sep-dot">.</span> <span class="count">' . $likes . '</span>'); $reply .= $a->build(); $a->set_class('comment-report'); $a->remove_attribute('data-session-liked-key'); $a->set_text('Báo cáo vi phạm' . '<i class="fa fa-flag"></i>'); $reply .= $a->build(); $a->set_class('comment-share'); $share_text = '<span class="text">' . 'Chia sẻ' . '<i class="fa fa-angle-down"></i></span>'; $share_text .= '<span class="list-share">'; $share_text .= '<i class="fa fa-facebook facebook" data-url="' . hocwp_get_social_share_url(array('social_name' => 'facebook', 'permalink' => $comment_permalink)) . '"></i>'; $share_text .= '<i class="fa fa-google-plus google" data-url="' . hocwp_get_social_share_url(array('social_name' => 'googleplus', 'permalink' => $comment_permalink)) . '"></i>'; $share_text .= '<i class="fa fa-twitter twitter" data-url="' . hocwp_get_social_share_url(array('social_name' => 'twitter', 'permalink' => $comment_permalink)) . '"></i>'; $share_text .= '</span>'; $a->set_text($share_text); $reply .= $a->build(); } $reply .= '</div>'; $article = new HOCWP_HTML('article'); $article->set_attribute('id', 'div-comment-' . $comment_id); $article->set_class('comment-body'); $article_text = $footer->build(); $article_text .= $comment_content; $article_text .= $reply; $article->set_text($article_text); $html = new HOCWP_HTML($tag); $comment_class = get_comment_class(empty($args['has_children']) ? '' : 'parent'); $comment_class = implode(' ', $comment_class); $html_atts = array('class' => $comment_class, 'id' => 'comment-' . $comment_id, 'data-comment-id' => $comment_id); $html->set_attribute_array($html_atts); $html->set_text($article->build()); $html->set_close(false); $html->output(); }
function hocwp_the_social_share_buttons($args = array()) { $socials = hocwp_get_value_by_key($args, 'socials'); if (!hocwp_array_has_value($socials)) { $socials = array('facebook' => 'Facebook', 'twitter' => 'Twitter', 'googleplus' => 'Google+', 'pinterest' => 'Pinterest', 'email' => 'Email'); $socials = apply_filters('hocwp_social_share_buttons', $socials); } ?> <div class="social-share"> <ul class="list-inline list-unstyled list-share-buttons"> <?php foreach ($socials as $social_name => $text) { $font_awesome = 'fa-' . $social_name; $btn_class = 'btn-' . $social_name; switch ($social_name) { case 'email': hocwp_add_string_with_space_before($font_awesome, 'fa-envelope'); break; case 'googleplus': case 'gplus': hocwp_add_string_with_space_before($font_awesome, 'fa-google-plus'); hocwp_add_string_with_space_before($btn_class, 'btn-google-plus'); break; } echo '<li><a target="_blank" href="' . hocwp_get_social_share_url(array('social_name' => $social_name)) . '" class="btn btn-social ' . $btn_class . '"><i class="fa ' . $font_awesome . ' icon-left"></i> ' . $text . '</a></li>'; } ?> </ul> </div> <?php }