'ol', 'type' => 'all', 'avatar_size' => 80, 'callback' => 'Easy_comments_callback', 'end-callback' => 'Easy_comments_end_callback' ); return apply_atomic( 'list_comments_args', $args ); } /** * Uses the $comment_type to determine which comment template should be used. Once the * template is located, it is loaded for use. Child themes can create custom templates based off * the $comment_type. The comment template hierarchy is comment-$comment_type.php, * comment.php. * * The templates are saved in $Easy->templates[comment_template], so each comment template * is only located once if it is needed. Following comments will use the saved template. * * @since 0.2.3 * @param $comment The comment variable * @param $args Array of arguments passed from wp_list_comments() * @param $depth What level the particular comment is */ function Easy_comments_callback( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; $comment_type = get_comment_type( $comment->comment_ID ); $cache = wp_cache_get( 'comment_template' ); if ( !is_array( $cache ) ) $cache = array(); if ( !isset( $cache[$comment_type] ) ) { $template = locate_template( array( "comment-{$comment_type}.php", 'comment.php' ) ); $cache[$comment_type] = $template; wp_cache_set( 'comment_template', $cache ); } if ( !empty( $cache[$comment_type] ) ) require( $cache[$comment_type] ); } /** * Ends the display of individual comments. Uses the callback parameter for wp_list_comments(). * Needs to be used in conjunction with Easy_comments_callback(). Not needed but used just in * case something is changed. * * @since 0.2.3 */ function Easy_comments_end_callback() { echo ''; } /** * Displays the avatar for the comment author and wraps it in the comment author's URL if it is * available. Adds a call to Easy_IMAGES . "/{$comment_type}.png" for the default avatars for * trackbacks and pingbacks. * * @since 0.2.0 * @global $comment The current comment's DB object. * @global $Easy The global Easy object. */ function Easy_avatar() { global $comment, $Easy; /* Make sure avatars are allowed before proceeding. */ if ( !get_option( 'show_avatars' ) ) return false; /* Get/set some comment variables. */ $comment_type = get_comment_type( $comment->comment_ID ); $author = esc_html( get_comment_author( $comment->comment_ID ) ); $url = esc_url( get_comment_author_url( $comment->comment_ID ) ); /* Set a default avatar for pingbacks and trackbacks. */ $default_avatar = ( ( 'pingback' == $comment_type || 'trackback' == $comment_type ) ? trailingslashit( Easy_IMAGES ) . "{$comment_type}.png" : '' ); /* Allow the default avatar to be filtered by comment type. */ $default_avatar = apply_filters( "{$Easy->prefix}_{$comment_type}_avatar", $default_avatar ); /* Set up the avatar size. */ $comment_list_args = Easy_list_comments_args(); $size = ( ( $comment_list_args['avatar_size'] ) ? $comment_list_args['avatar_size'] : 80 ); /* Get the avatar provided by the get_avatar() function. */ $avatar = get_avatar( get_comment_author_email( $comment->comment_ID ), absint( $size ), $default_avatar, $author ); /* If URL input, wrap avatar in hyperlink. */ if ( !empty( $url ) ) $avatar = '' . $avatar . ''; /* Display the avatar and allow it to be filtered. Note: Use the get_avatar filter hook where possible. */ echo apply_filters( "{$Easy->prefix}_avatar", $avatar ); } /** * Filters the WordPress comment_form() function that was added in WordPress 3.0. This allows * the theme to preserve some backwards compatibility with its old comment form. It also allows * users to build custom comment forms by filtering 'comment_form_defaults' in their child theme. * * @since 0.8.0 * @param array $args The default comment form arguments. * @return array $args The filtered comment form arguments. */ function Easy_comment_form_args( $args ) { global $user_identity; $domain = Easy_get_textdomain(); $commenter = wp_get_current_commenter(); $req = ( ( get_option( 'require_name_email' ) ) ? ' ' . __( '*', $domain ) . ' ' : '' ); $input_class = ( ( get_option( 'require_name_email' ) ) ? ' req' : '' ); $fields = array( 'author' => '

', 'email' => '

', 'url' => '

' ); $args = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => '

', 'must_log_in' => '

' . sprintf( __( 'You must be logged in to post a comment.', $domain ), wp_login_url( get_permalink() ) ) . '

', 'logged_in_as' => '

' . sprintf( __( 'Logged in as %2$s.', $domain ), admin_url( 'profile.php' ), esc_attr( $user_identity ) ) . ' ' . __( 'Log out »', $domain ) . '

', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __( 'Leave a Reply', $domain ), 'title_reply_to' => __( 'Leave a Reply to %s', $domain ), 'cancel_reply_link' => __( 'Click here to cancel reply.', $domain ), 'label_submit' => __( 'Post Comment', $domain ), ); return $args; } ?>