/**
  * Verify validity of ajax request and pass it to the internal handler.
  */
 function debug_bar_shortcodes_do_ajax()
 {
     // Verify this is a valid ajax request.
     if (!isset($_POST['dbs-nonce']) || false === wp_verify_nonce($_POST['dbs-nonce'], 'debug-bar-shortcodes')) {
         exit('-1');
     }
     // Verify we have received the data needed to do anything.
     if (!isset($_POST['shortcode']) || '' === $_POST['shortcode']) {
         exit('-1');
     }
     $output_rendering = new Debug_Bar_Shortcodes_Render();
     $shortcode = trim($_POST['shortcode']);
     // Exit early if this is a non-existent shortcode - shouldn't happen, but hack knows ;-).
     if (false === shortcode_exists($shortcode)) {
         $response = array('id' => 0, 'data' => '');
         $output_rendering->send_ajax_response($response);
         exit;
     }
     // Send the request to our handler.
     switch ($_POST['action']) {
         case 'debug-bar-shortcodes-find':
             $output_rendering->ajax_find_shortcode_uses($shortcode);
             break;
         case 'debug-bar-shortcodes-retrieve':
             $output_rendering->ajax_retrieve_details($shortcode);
             break;
         default:
             // Intentionally empty.
             break;
     }
     /*
       No valid action received (redundancy, can't really happen as WP wouldn't then call this
       function, but would return 0 and exit already.
     */
     exit('-1');
 }