public static function request_deletion($commentID = 0, $postID = 0, $message)
 {
     $canedit = AECCore::can_edit($commentID, $postID);
     if (is_string($canedit)) {
         return 'request_deletion_failed';
     }
     if (wp_set_comment_status($commentID, 'hold') || wp_get_comment_status($commentID) == "unapproved") {
         AECAjax::request_deletion_message($commentID, $message);
         //Get the comment and remove the cookie
         $comment = get_comment($commentID);
         $hash = md5($comment->comment_author_IP . $comment->comment_date_gmt);
         $GLOBALS['WPAjaxEditCommentsComment' . $commentID . $hash] = '';
         //for CFORMS compatibility
         setcookie('WPAjaxEditCommentsComment' . $commentID . $hash, '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);
         //removes the cookie
         return 1;
     } else {
         return 'request_deletion_failed';
     }
 }
 public function init()
 {
     //If registered users can only comment and user is not logged in, skip loading the plugin.
     include_once ABSPATH . WPINC . '/pluggable.php';
     if (get_option('comment_registration') == '1') {
         if (!is_user_logged_in()) {
             return;
         }
     }
     //Initialize Addons
     do_action('aec-addons-init');
     $this->plugin_url = apply_filters('aec-addons-plugin-directory', $this->get_plugin_url());
     $this->colorbox_params['script_handler'] = apply_filters('aec-colorbox-script-name', 'colorbox');
     $this->colorbox_params['style_handler'] = apply_filters('aec-colorbox-style-name', 'colorbox');
     //If a user isn't logged in and has no comment cookie, don't load the plugin either
     if (!is_user_logged_in()) {
         $cookieloaded = false;
         foreach ($_COOKIE as $value => $key) {
             if (strstr($value, 'WPAjaxEditCommentsComment')) {
                 $cookieloaded = true;
                 break;
             }
         }
         if (!$cookieloaded) {
             add_action("wp_print_styles", array('AECDependencies', 'load_frontend_css'));
             add_action('wp_print_scripts', array('AECDependencies', 'load_frontend'), 1000);
             return;
         }
     }
     add_action('wp_print_scripts', array('AECDependencies', 'ajax_url'), 12);
     $this->errors = AECCore::initialize_errors();
     $this->skip = false;
     //css
     add_action("wp_print_styles", array('AECDependencies', "load_frontend_css"));
     add_action("wp_print_styles", array('AECDependencies', "add_css"));
     add_action('admin_print_styles', array('AECDependencies', "add_css"));
     //JavaScript
     add_action('admin_print_scripts-index.php', array('AECDependencies', 'add_post_scripts'), 1000);
     add_action('admin_print_scripts-edit-comments.php', array('AECDependencies', 'add_post_scripts'), 1000);
     if (!is_admin()) {
         add_action('wp_print_scripts', array('AECDependencies', 'add_post_scripts'), 1000);
     }
     //Ajax stuff
     AECAjax::initialize_actions();
     //Admin options
     if (AECCore::is_multisite()) {
         add_action('network_admin_menu', array("AECAdmin", 'add_admin_pages'));
     } else {
         add_action('admin_menu', array("AECAdmin", 'add_admin_pages'));
     }
     add_action('template_redirect', array($this, 'comment_text'));
     //front end
     add_action('auth_redirect', array($this, 'comment_text'));
     //admin panel
     //* Localization Code */
     load_plugin_textdomain('ajaxEdit', false, dirname(plugin_basename(__FILE__)) . '/languages/');
 }