function bwg_add_embed_ajax() { if (function_exists('current_user_can')) { if (!current_user_can('manage_options')) { die('Access Denied'); } } else { die('Access Denied'); } require_once WD_BWG_DIR . '/framework/WDWLibrary.php'; if (!WDWLibrary::verify_nonce('')) { die(WDWLibrary::delimit_wd_output(json_encode(array("error", "Sorry, your nonce did not verify.")))); } require_once WD_BWG_DIR . '/framework/WDWLibraryEmbed.php'; $embed_action = WDWLibrary::get('action'); if ($embed_action != '' && $embed_action == 'addEmbed') { $url_to_embed = WDWLibrary::get('URL_to_embed'); $data = WDWLibraryEmbed::add_embed($url_to_embed); echo WDWLibrary::delimit_wd_output($data); wp_die(); } die('Nothing to add'); }