/** * Display the html email link to the author of the current comment. * * Care should be taken to protect the email address and assure that email * harvesters do not capture your commentors' email address. Most assume that * their email address will not appear in raw form on the blog. Doing so will * enable anyone, including those that people don't want to get the email * address and use it for their own means good and bad. * * @since 0.71 * * @param string $linktext Optional. Text to display instead of the comment author's email address. * Default empty. * @param string $before Optional. Text or HTML to display before the email link. Default empty. * @param string $after Optional. Text or HTML to display after the email link. Default empty. */ function comment_author_email_link($linktext = '', $before = '', $after = '') { if ($link = get_comment_author_email_link($linktext, $before, $after)) { echo $link; } }
/** * @ticket 36571 */ public function test_comment_param_should_override_global() { $comment = self::factory()->comment->create_and_get(array('comment_author_email' => $email = '*****@*****.**')); $expected = sprintf('<a href="mailto:%1$s">%2$s</a>', $email, $email); $this->assertEquals($expected, get_comment_author_email_link('', '', '', $comment)); }
<tbody> <tr valign="top"> <td class="first"><?php _e('Name:'); ?> </td> <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr($comment->comment_author); ?> " id="name" /></td> </tr> <tr valign="top"> <td class="first"> <?php if ($comment->comment_author_email) { printf(__('E-mail (%s):'), get_comment_author_email_link(__('send e-mail'), '', '')); } else { _e('E-mail:'); } ?> </td> <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?> " id="email" /></td> </tr> <tr valign="top"> <td class="first"> <?php if (!empty($comment->comment_author_url) && 'http://' != $comment->comment_author_url) { $link = '<a href="' . $comment->comment_author_url . '" rel="external nofollow" target="_blank">' . __('visit site') . '</a>';
function body_cell($key, $value, $i) { global $comment, $lg_gallery; // set global $comment so we can use WordPress functions $comment = $this->items[$i]; $comment_ID = $comment->comment_ID; // in this table we only shows approved comments $comment_status = 'approve'; $pending_comments = 0; switch ($key) { case 'author': $author_url = get_comment_author_url(); $cell = '<td class="author column-author">'; $cell .= sprintf('<strong> %s %s </strong><br />', get_avatar($comment, 32), get_comment_author($comment)); if (current_user_can('moderate_comments')) { if (!empty($comment->comment_author_email)) { $cell .= get_comment_author_email_link() . '<br />'; } $cell .= sprintf('<a href="edit-comments.php?s=%s&mode=detail">%s</a>', get_comment_author_IP($comment), get_comment_author_IP($comment)); } $cell .= '</td>'; break; case 'comment': $approve_nonce = esc_html('_wpnonce=' . wp_create_nonce("approve-comment_{$comment_ID}")); $del_nonce = esc_html('_wpnonce=' . wp_create_nonce("delete-comment_{$comment_ID}")); $postID = $lg_gallery->get_option('gallery_id'); $cell = '<td class="comment column-comment">'; $filevar = isset($comment->filevar) ? $comment->filevar : ''; $uri = trailingslashit($lg_gallery->get_option('gallery_prev')); if ('TRUE' != $lg_gallery->get_option('use_permalinks')) { $comment_url = add_query_arg('file', $filevar, $uri); } else { $comment_url = trailingslashit($uri . $filevar); } $comment_url .= '#comment-' . $comment_ID; $cell .= '<div class="submitted-on">'; $cell .= sprintf(__('Submitted on <a href="%1$s">%2$s - %3$s</a>'), esc_url($comment_url), get_comment_date(get_option('date_format')), get_comment_date(get_option('time_format'))); $cell .= sprintf('<p>%s</p>', apply_filters('comment_text', get_comment_text($comment), $comment)); if (current_user_can('moderate_comments')) { $cell .= '<div class="row-actions">'; $cell .= sprintf('<span class="unapprove"><a href="%s" class="delete:the-comment-list:comment-%s:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive" title="%s">%s</a> | </span>', esc_url("comment.php?action=unapprovecomment&p={$postID}&c={$comment_ID}&{$approve_nonce}"), $comment_ID, esc_attr__('Unapprove this comment'), __('Unapprove')); $cell .= sprintf('<span class="edit"><a href="comment.php?action=editcomment&c=%s" title="%s">%s</a> | </span>', $comment_ID, esc_attr__('Edit comment'), __('Edit')); $cell .= sprintf('<span class="spam"><a href="%s" class="delete:the-comment-list:comment-%s::spam=1 vim-s vim-destructive" title="%s">%s</a> | </span>', esc_url("comment.php?action=spamcomment&p={$postID}&c={$comment_ID}&{$del_nonce}"), $comment_ID, esc_attr__('Mark this comment as spam'), _x('Spam', 'verb')); $cell .= sprintf('<span class="trash"><a href="%s" class="delete:the-comment-list:%s::trash=1 delete vim-d vim-destructive" title="%s">%s</a></span>', esc_url("comment.php?action=trashcomment&p={$postID}&c={$comment_ID}&{$del_nonce}"), $comment_ID, esc_attr__('Move this comment to the trash'), _x('Trash', 'verb')); } $cell .= '</td>'; break; case 'response': $cell = '<td class="response column-response">'; $edit_title = esc_html__('Gallery', 'lazyest-gallery'); $edit_url = admin_url('admin.php?page=lazyest-filemanager&folder='); $filevar = isset($comment->filevar) ? stripslashes(rawurldecode($comment->filevar)) : $lg_gallery->commentor->get_file_by_comment_id($comment_ID); $preview = $lg_gallery->get_option('gallery_prev'); $class = 'alignright'; $img_src = trailingslashit($lg_gallery->plugin_url) . 'images/folders.png'; $img_alt = __('Icon', 'lazyest-gallery'); $img_title = __('Click to View', 'lazyest-gallery'); $img_id = 0; $img_class = 'lg'; if ('' !== $filevar) { $edit_url .= $lg_gallery->is_folder($filevar) ? lg_nice_link($filevar) : lg_nice_link(dirname($filevar)); if ($lg_gallery->is_folder($filevar)) { $folder = new LazyestFolder($filevar); $folder->open(); $edit_title = $folder->title(); $preview = $folder->uri(); $img_src = trailingslashit($lg_gallery->plugin_url) . 'images/folder-icon.png'; $img_id = $folder->id; } if ($lg_gallery->is_image($filevar)) { $folder = new LazyestFolder(dirname($filevar)); $image = $folder->single_image(basename($filevar), 'thumbs'); $edit_url .= '#' . $image->form_name(); $edit_title = $image->title(); $onclick = $image->on_click(); $preview = $onclick['href']; $class .= ' ' . $onclick['class']; $img_src = $image->src(); if ('TRUE' == $lg_gallery->get_option('async_cache') && !file_exists($image->loc())) { $img_class = 'lg_ajax'; } $img_alt = $image->alt(); $img_id = $image->id; } } $cell .= '<div class="response-links"><span class="post-com-count-wrapper">'; $cell .= sprintf('<a href="%s">%s</a><br />', $edit_url, $edit_title); $cell .= sprintf('<a href="admin.php?page=lazyest-filemanager&edit=comments&file=%s" title="%s" class="post-com-count"><span class="comment-count">%s</span></a>', $filevar, esc_attr(__('0 pending')), $lg_gallery->commentor->count_comments($img_id)); $cell .= '</div>'; $cell .= sprintf('<a target="_blank" href="%s" class="alignright"><img width="32" height="32" src="%s" alt="%s" title="%s" class="%s" /></a>', $preview, $img_src, $img_alt, $img_title, $img_class); $cell .= "</td>\n"; break; } return $cell; }