__construct();} /** * PHP 5 Constructor */ function __construct(){ $this->adminOptions = $this->get_admin_options(); if ( !defined('WP_CONTENT_URL') ) define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); if ( !defined('WP_CONTENT_DIR')) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); $this->pluginDir = WP_CONTENT_URL . '/plugins/wp-ajax-edit-comments'; $this->initialize_errors(); $this->skip = false; //css add_action("wp_head", array(&$this,"add_css")); add_action('admin_head', array(&$this,"add_css")); //JavaScript add_action('admin_print_scripts', array(&$this,'add_post_scripts'),1000); add_action('wp_print_scripts', array(&$this,'add_post_scripts'),1000); add_action('wp_head', array(&$this, 'add_script_vars'), 1001); add_action('admin_head', array(&$this,"add_script_vars"), 1001); //Custom actions for other plugin authors add_action('add_wp_ajax_comments_js_post', array(&$this,'add_post_scripts')); add_action('add_wp_ajax_comments_js_admin', array(&$this,'add_post_scripts')); add_action('wp_ajax_comments_comment_edited', array(&$this, 'edit_notification'),1,2); add_action('wp_ajax_comments_comment_edited', array(&$this, 'comment_edited'),2,2); add_action('wp_ajax_comments_remove_content_filter', array(&$this, 'comment_filter')); //Initialization stuff add_action('init', array(&$this, 'init')); //Admin options add_action('admin_menu', array(&$this,'add_admin_pages')); //When a comment is posted add_action('comment_post', array(&$this, 'comment_posted'),100,1); //Yay, filters. add_filter('comment_text', array(&$this, 'add_edit_links'), '1000'); //Low priority so other HTML can be added first add_filter('get_comment_author_link', array(&$this, 'add_author_spans'), '1000'); //Low priority so other HTML can be added first } /* add_author_spans - Adds spans to author links */ function add_author_spans($content) { global $comment; if (empty($comment)) { return $content; } if ($this->can_edit_quickcheck($comment) != 1) { return $content; } //--ag if ($this->can_edit($comment->comment_ID, $comment->comment_post_ID) != 1) { return $content; } $content = ""; return $content; } /* add_edit_links - Adds edit links to post and admin panels */ function add_edit_links($content) { global $comment; if ($this->skip) { $this->skip = false; return $content; } if (empty($comment)) { return $content; } if (is_page() && $this->adminOptions['show_pages'] != 'true') { return $content; } if (empty($comment->comment_author_url) || $comment->comment_author_url == "http://") { $delink = false; } if ($this->can_edit_quickcheck($comment) != 1) { return $content; } //--ag if ($this->can_edit($comment->comment_ID, $comment->comment_post_ID) != 1) { return $content; } $ajax_url = $this->pluginDir . "/php/AjaxEditComments.php"; if (!$this->admin || $this->adminOptions['show_advanced'] == "false") { $edit_url = clean_url($this->pluginDir . "/php/comment-editor.php" . "?action=editcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&KeepThis=true&TB_iframe=true&height=400&width=560&modal=true", "editcomment_$comment->comment_ID"); } else { $edit_url = clean_url($this->pluginDir . "/php/comment-editor.php" . "?action=editcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&KeepThis=true&TB_iframe=true&height=525&width=560&modal=true", "editcomment_$comment->comment_ID"); } $move_comment_url = clean_url(wp_nonce_url($this->pluginDir . "/php/move-comment.php" . "?action=movecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&KeepThis=true&TB_iframe=true&height=400&width=560&modal=true", "movecomment_$comment->comment_ID")); $request_deletion_url = clean_url(wp_nonce_url($this->pluginDir . "/php/request-deletion.php" . "?action=requestdeletion&p=$comment->comment_post_ID&c=$comment->comment_ID&KeepThis=true&TB_iframe=true&height=400&width=560&modal=true", "requestdeletion_$comment->comment_ID")); $spam_url = clean_url( wp_nonce_url( $ajax_url . "?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "spamcomment_$comment->comment_ID" ) ); $delete_url = clean_url( wp_nonce_url( $ajax_url . "?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "deletecomment_$comment->comment_ID" ) ); $moderate_url = clean_url( wp_nonce_url( $ajax_url . "?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprovecomment_$comment->comment_ID" ) ); $approve_url = clean_url( wp_nonce_url( $ajax_url . "?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approvecomment_$comment->comment_ID" ) ); $delink_url = clean_url( wp_nonce_url( $ajax_url . "?action=delinkcomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delinkcomment_$comment->comment_ID" ) ); //Icon Classes $spam_class=$moderate_class=$edit_class=$approve_class=$delete_class=$beginning=$seperator=$end=$clearfix=$timer_class=''; $edit_admin = "edit-comment-admin-links"; if ($this->adminOptions['allow_icons'] == 'true') { $spam_class = 'spam-comment'; $moderate_class = 'moderate-comment'; $edit_class = 'edit-comment'; $request_deletion_class = "request-deletion-comment"; $approve_class = 'approve-comment'; $delete_class = 'delete-comment'; $delink_class = 'delink-comment'; $move_class = "move-comment"; } else { $edit_admin = "edit-comment-admin-links-no-icon"; $timer_class = "ajax-edit-time-left-no-icon"; $beginning = "[ "; $seperator = " | "; $end = " ]"; } if ($this->adminOptions['clear_after'] == 'true') { $clearfix = "clearfix"; } if ($this->adminOptions['comment_display_top'] == 'true') { $aec_top = true; } $tempContent = $content; //temporary variable to store content /*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 = '