function wpas_register_addon($id, $callback, $priority = 10)
{
    if (array_key_exists($id, WPAS()->addons)) {
        wpas_debug_display(sprintf(__('An addon with the ID %s is already registered', 'awesome-support'), $id));
        return false;
    }
    WPAS()->addons[$id] = array('status' => 'registered', 'priority' => $priority, 'callback' => $callback);
}
function wpas_register_addon($id, $callback, $priority = 10)
{
    global $wpas_addons;
    if (array_key_exists($id, $wpas_addons)) {
        wpas_debug_display(sprintf(__('An addon with the ID %s is already registered', 'wpas'), $id));
        return false;
    }
    $wpas_addons[$id] = array('status' => 'registered', 'priority' => $priority, 'callback' => $callback);
}
    /**
     * Load TinyMCE.
     *
     * Loads a new instance of TinyMCE and extend
     * the JS object that instantiate the editor.
     *
     * @since  3.1.5
     */
    public function editor_html()
    {
        $post_id = filter_input(INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT);
        $editor_id = filter_input(INPUT_POST, 'editor_id', FILTER_SANITIZE_STRING);
        $name = filter_input(INPUT_POST, 'textarea_name', FILTER_SANITIZE_STRING);
        $settings = (array) filter_input(INPUT_POST, 'editor_settings', FILTER_UNSAFE_RAW);
        if (empty($editor_id)) {
            wpas_debug_display(__('An editor ID is mandatory to load a new instance of TinyMCE', 'awesome-support'));
            die;
        }
        /**
         * If we got a post id then we gather the rest of the data from here.
         */
        if (!empty($post_id)) {
            $post = get_post($post_id);
        }
        /**
         * Get the content and filter it.
         */
        $content = isset($post) && !empty($post) ? $post->post_content : filter_input(INPUT_POST, 'editor_content', FILTER_SANITIZE_STRING);
        $content = apply_filters('the_content', $content);
        /**
         * Filter the user settings for the editor
         */
        $settings = $this->get_editor_settings($settings);
        /**
         * Force QuickTags to false due to the WordPress bug
         */
        $settings['quicktags'] = false;
        /**
         * Make sure we have a textarea name
         */
        if (!isset($settings['textarea_name']) || empty($settings['textarea_name'])) {
            $settings['textarea_name'] = !empty($name) ? $name : $editor_id;
        }
        /**
         * Load a new instance of TinyMCE.
         */
        wp_editor($content, $editor_id, $settings);
        /**
         * Update the TinyMCE and QuickTags pre-init objects.
         */
        $mce_init = $this->get_mce_init($editor_id);
        $qt_init = $this->get_qt_init($editor_id);
        ?>

		<script type="text/javascript">
			tinyMCEPreInit.mceInit = jQuery.extend( tinyMCEPreInit.mceInit, <?php 
        echo $mce_init;
        ?>
);
			tinyMCEPreInit.qtInit = jQuery.extend( tinyMCEPreInit.qtInit, <?php 
        echo $qt_init;
        ?>
);
		</script>

		<?php 
        die;
    }
 public function save_bulk_edit_ticket()
 {
     // TODO perform nonce checking
     // get our variables
     $post_ids = !empty($_POST['post_ids']) ? $_POST['post_ids'] : array();
     $status = !empty($_POST['_wpas_status']) ? $_POST['_wpas_status'] : null;
     $state = !empty($_POST['_wpas_state']) ? $_POST['_wpas_state'] : null;
     wpas_debug_display($post_ids);
     wpas_debug_display($status);
     wpas_debug_display($state);
     exit;
     // if everything is in order
     if (!empty($post_ids) && is_array($post_ids)) {
         foreach ($post_ids as $post_id) {
             wpas_update_ticket_status($post_id, $state);
             if (in_array($status, array('open', 'closed'))) {
                 update_post_meta($post_id, '_wpas_status', $status);
             }
         }
     }
     die;
 }