comment_ID, 'notify_me', true); if(!empty($notify_me)) { } } fansub_delete_transient('fansub_top_commenters'); do_action('fansub_comment_status_changed', $comment); } } add_action('transition_comment_status', 'fansub_comment_transition_comment_status', 10, 3); function fansub_comment_form_default_fields($fields) { $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $format = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml'; $format = apply_filters('fansub_comment_form_format', $format); $req = get_option('require_name_email'); $aria_req = ($req ? "aria-required='true'" : ''); $html_req = ($req ? "required='required'" : ''); $required_html = ''; fansub_add_string_with_space_before($required_html, $aria_req); fansub_add_string_with_space_before($required_html, $html_req); $html5 = 'html5' === $format; $fields = array( 'author' => '

' . ' ' . '

', 'email' => '

' . '

', 'url' => '

' . '

', ); return $fields; } add_filter('comment_form_default_fields', 'fansub_comment_form_default_fields'); function fansub_comment_form_defaults($defaults) { $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $format = current_theme_supports('html5', 'comment-form') ? 'html5' : 'xhtml'; $format = apply_filters('fansub_comment_form_format', $format); $req = get_option('require_name_email'); $aria_req = ($req ? " aria-required='true'" : ''); $html_req = ($req ? " required='required'" : ''); $required_text = sprintf(' ' . __('Required fields are marked %s', 'fansub'), '*'); $html5 = 'html5' === $format; $defaults = array( 'comment_field' => '

', 'must_log_in' => '

' . sprintf(__('You must be logged in to post a comment.', 'fansub'), wp_login_url(apply_filters('the_permalink', get_permalink(get_the_ID())))) . '

', 'logged_in_as' => '

' . sprintf(__('Logged in as %2$s. Log out?', 'fansub'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink(get_the_ID())))) . '

', 'comment_notes_before' => '

' . __('Your email address will not be published.', 'fansub') . ''. ($req ? $required_text : '') . '

', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_submit' => 'submit', 'name_submit' => 'submit', 'title_reply' => '' . __('Leave a Reply', 'fansub') . '', 'title_reply_to' => __('Leave a Reply to %s', 'fansub'), 'cancel_reply_link' => __('Click here to cancel reply.', 'fansub'), 'label_submit' => __('Post Comment', 'fansub'), 'submit_button' => '', 'submit_field' => '

%1$s %2$s

', 'format' => 'html5' ); return $defaults; } add_filter('comment_form_defaults', 'fansub_comment_form_defaults'); function fansub_wp_list_comments_args($args) { $args['reply_text'] = '' . __('Reply', 'fansub') . ''; return $args; } add_filter('wp_list_comments_args', 'fansub_wp_list_comments_args', 10); function fansub_get_comment_likes($comment_id) { $result = get_comment_meta($comment_id, 'likes', true); $result = absint($result); return $result; } function fansub_facebook_comment($args = array()) { $args = apply_filters('fansub_facebook_comment_args', $args); $colorscheme = isset($args['colorscheme']) ? $args['colorscheme'] : 'light'; $colorscheme = apply_filters('fansub_facebook_comment_colorscheme', $colorscheme, $args); $href = isset($args['href']) ? $args['href'] : ''; if(empty($href)) { if(is_single() || is_page() || is_singular()) { $href = get_the_permalink(); } } if(empty($href)) { $href = $this->get_current_url(); } $href = apply_filters('fansub_facebook_comment_href', $href, $args); $mobile = isset($args['mobile']) ? $args['mobile'] : ''; $num_posts = isset($args['num_posts']) ? $args['num_posts'] : 10; $num_posts = apply_filters('fansub_facebook_comment_num_posts', $num_posts, $args); $order_by = isset($args['order_by']) ? $args['order_by'] : 'social'; $width = isset($args['width']) ? $args['width'] : '100%'; $width = apply_filters('fansub_facebook_comment_width', $width, $args); $loading_text = fansub_get_value_by_key($args, 'loading_text', __('Loading...', 'fansub')); $div = new FANSUB_HTML('div'); $div->set_class('fb-comments'); $atts = array( 'data-colorscheme' => $colorscheme, 'data-href' => $href, 'data-mobile' => $mobile, 'data-numposts' => $num_posts, 'data-order-by' => $order_by, 'data-width' => $width ); $atts = apply_filters('fansub_facebook_comment_attributes', $atts, $args); $div->set_attribute_array($atts); $div->set_text($loading_text); $div->output(); } function fansub_google_comment() { ?>
comments . ' WHERE comment_author_email != "" AND comment_type = "" AND comment_approved = 1'; $expires = HOUR_IN_SECONDS; switch($time) { case 'today': $sql .= ' AND DAY(comment_date) = DAY(CURDATE()) AND MONTH(comment_date) = MONTH(CURDATE()) AND YEAR(comment_date) = YEAR(CURDATE())'; break; case 'week': case 'this_week': $sql .= ' AND YEARWEEK(comment_date) = YEARWEEK(NOW())'; $expires = 12 * HOUR_IN_SECONDS; break; case 'month': case 'this_month': $sql .= ' AND MONTH(comment_date) = MONTH(CURDATE()) AND YEAR(comment_date) = YEAR(CURDATE())'; $expires = DAY_IN_SECONDS; break; case 'year': case 'this_year': $sql .= ' AND YEAR(comment_date) = YEAR(CURDATE())'; $expires = 2 * DAY_IN_SECONDS; break; } $condition = trim($condition); if(!empty($condition)) { $sql .= ' ' . $condition; } $sql .= ' GROUP BY comment_author_email ORDER BY comments_count DESC, comment_author ASC LIMIT ' . $number; $results = $wpdb->get_results($sql); set_transient($transient_name, $results, $expires); } return $results; } function fansub_comment_inserted_hook($id, $comment) { fansub_delete_transient('fansub_top_commenters'); } add_action('wp_insert_comment', 'fansub_comment_inserted_hook', 10, 2);