public static function add_edit_links($content) { global $comment, $aecomments; if ($aecomments->skip) { $aecomments->skip = false; return $content; } if (empty($comment)) { return $content; } if (is_page() && $aecomments->get_admin_option('show_pages') != 'true') { return $content; } if (AECCore::can_edit_quickcheck($comment) != 1) { return $content; } //--ag if (AECCore::can_edit($comment->comment_ID, $comment->comment_post_ID) != 1) { return $content; } if ($aecomments->get_admin_option('comment_display_top') == 'true') { $aec_top = true; } $tempContent = $content; //temporary variable to store content $edit_admin = "edit-comment-admin-links"; $clearfix = $timer_class = ''; if ($aecomments->get_admin_option('icon_display') != 'classic' && $aecomments->get_admin_option('icon_display') != 'dropdown') { $edit_admin = "edit-comment-admin-links-no-icon"; $timer_class = "ajax-edit-time-left-no-icon"; } /*If you're wondering why the JS is inline, it's because people with 500+ comments were having their browsers lock up. With inline, the JS is run as needed. Not elegant, but the best solution.*/ if (!isset($aec_top)) { //Test to see if user wants interface on top or bottom $content = '<div class="edit-comment" id="edit-comment' . $comment->comment_ID . '" style="background: none">' . $content . '</div>'; $content .= "<div id='comment-undo-{$comment->comment_ID}' class='aec-undo' style='background: none'></div>"; } else { $content = ''; } if (!AECCore::is_comment_owner($comment->comment_post_ID)) { //For anonymous users $content .= "<div class='{$edit_admin} {$clearfix}' id='edit-comment-user-link-{$comment->comment_ID}' style='background:none'>"; $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID); $content .= "</div>"; //Show custom content to users if (AECCore::show_affiliate_link()) { $message = do_shortcode(stripslashes($aecomments->get_admin_option('affiliate_text'))); $message = str_replace("[url]", "<a href='http://www.ajaxeditcomments.com/?affiliate_id=" . $aecomments->get_admin_option('affiliate_id') . "'>", $message); $message = str_replace("[/url]", "</a>", $message); $content .= "<div class='aec-custom-text'>{$message}</div><!--/aec-custom-text-->"; } //End for anonymous users } else { //Check if user is editor $role = AECUtility::get_user_role(); //todo change editor to capability if ($role == 'editor' && $aecomments->get_admin_option('allow_editing_editors') == 'false') { return $content; } if (is_admin() && $aecomments->get_admin_option('admin_editing') == "false") { //We're in the admin panel $content .= '<div class="' . $edit_admin . ' ' . $clearfix . '" id="edit-comment-admin-links' . $comment->comment_ID . '">'; $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID); $content .= "</div>"; //End in the admin panel } elseif ($aecomments->get_user_option('comment_editing') == "true") { //We're in a post $content .= '<div class="' . $edit_admin . ' ' . $clearfix . '" id="edit-comment-admin-links' . $comment->comment_ID . '" style="background: none">'; $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID); $content .= "</div>"; } } if (isset($aec_top)) { //Test to see if user wants interface on top or bottom $content .= "<div id='comment-undo-{$comment->comment_ID}' class='aec-undo' style='background: none'></div>"; $content .= '<div class="edit-comment" id="edit-comment' . $comment->comment_ID . '" style="background: none">' . $tempContent . '</div>'; } return $content; }