WordPress.org

Make WordPress Core

Ticket #4851: vcard-start.diff

File vcard-start.diff, 2.9 KB (added by Otto42, 11 years ago)

vcard patch - first attempt

  • wp-includes/author-template.php

     
    188188 */
    189189function the_author_link() {
    190190        if (get_the_author_url()) {
    191                 echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
     191                echo '<span class="vcard"><a class="url fn" href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a></span>';
    192192        } else {
    193193                the_author();
    194194        }
  • wp-includes/comment-template.php

     
    2626        echo apply_filters('author_email', get_comment_author_email() );
    2727}
    2828
    29 function comment_author_email_link($linktext='', $before='', $after='') {
     29function get_comment_author_email_link($linktext='', $before='', $after='')
     30{
    3031        global $comment;
    3132        $email = apply_filters('comment_email', $comment->comment_author_email);
    3233        if ((!empty($email)) && ($email != '@')) {
    3334        $display = ($linktext != '') ? $linktext : $email;
    34                 echo $before;
    35                 echo "<a href='mailto:$email'>$display</a>";
    36                 echo $after;
     35                $return = $before;
     36                if (get_comment_type() == 'comment')
     37                        $return .= "<span class='vcard'><a class='email fn' href='mailto:$email'>$display</a></span>";
     38                else
     39                        $return .= "<a href='mailto:$email'>$display</a>";
     40                $return .= $after;
    3741        }
     42        return apply_filters('get_comment_author_email_link', $return);
    3843}
    3944
     45function comment_author_email_link($linktext='', $before='', $after='') {
     46        echo get_comment_author_email_link($linktext, $before, $after);
     47}
     48
    4049function get_comment_author_link() {
    4150        global $comment;
    4251        $url    = get_comment_author_url();
     
    4453
    4554        if ( empty( $url ) || 'http://' == $url )
    4655                $return = $author;
     56        else if (get_comment_type() == 'comment') // don't want a vcard for ping/trackbacks
     57                $return = "<span class='vcard'><a class='url fn' href='$url' rel='external nofollow'>$author</a></span>";
    4758        else
    4859                $return = "<a href='$url' rel='external nofollow'>$author</a>";
    4960        return apply_filters('get_comment_author_link', $return);
     
    7990        $display = str_replace( 'http://', '', $display );
    8091        if ( '/' == substr($display, -1) )
    8192                $display = substr($display, 0, -1);
    82         $return = "$before<a href='$url' rel='external'>$display</a>$after";
     93        if (get_comment_type() == 'comment')
     94                $return = "$before<span class='vcard'><a class='url fn' href='$url' rel='external'>$display</a></span>$after";
     95        else
     96                $return = "$before<a href='$url' rel='external'>$display</a>$after";
    8397        return apply_filters('get_comment_author_url_link', $return);
    8498}
    8599
     
    370384        echo '</a>';
    371385}
    372386
    373 ?>
     387?>
     388 No newline at end of file