<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[19802] trunk/wp-admin/includes/ajax-actions.php: Use wp_die() in ajax-actions.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/19802">19802</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-01-31 22:14:39 +0000 (Tue, 31 Jan 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use wp_die() in ajax-actions. props kurtpayne. see <a href="http://core.trac.wordpress.org/changeset/19801">[19801]</a>, fixes <a href="http://core.trac.wordpress.org/ticket/15327">#15327</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesajaxactionsphp">trunk/wp-admin/includes/ajax-actions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ajax-actions.php (19801 => 19802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ajax-actions.php        2012-01-31 22:12:58 UTC (rev 19801)
+++ trunk/wp-admin/includes/ajax-actions.php        2012-01-31 22:14:39 UTC (rev 19802)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">         $id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
</span><span class="cx">
</span><span class="cx">         if ( ! $id )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="_blank">Please log in again.</a>'), wp_login_url() );
</span><span class="cx">         $x = new WP_Ajax_Response( array(
</span><span class="lines">@@ -41,14 +41,14 @@
</span><span class="cx">
</span><span class="cx">         $wp_list_table = _get_list_table( $list_class );
</span><span class="cx">         if ( ! $wp_list_table )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         if ( ! $wp_list_table->ajax_user_can() )
</span><del>-                die( '-1' );
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $wp_list_table->ajax_response();
</span><span class="cx">
</span><del>-        die( '0' );
</del><ins>+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx"> function wp_ajax_ajax_tag_search() {
</span><span class="cx">         global $wpdb;
</span><span class="lines">@@ -57,11 +57,11 @@
</span><span class="cx">                 $taxonomy = sanitize_key( $_GET['tax'] );
</span><span class="cx">                 $tax = get_taxonomy( $taxonomy );
</span><span class="cx">                 if ( ! $tax )
</span><del>-                        die( '0' );
</del><ins>+                        wp_die( 0 );
</ins><span class="cx">                 if ( ! current_user_can( $tax->cap->assign_terms ) )
</span><del>-                        die( '-1' );
</del><ins>+                        wp_die( -1 );
</ins><span class="cx">         } else {
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $s = stripslashes( $_GET['q'] );
</span><span class="lines">@@ -72,21 +72,21 @@
</span><span class="cx">         }
</span><span class="cx">         $s = trim( $s );
</span><span class="cx">         if ( strlen( $s ) < 2 )
</span><del>-                die; // require 2 chars for matching
</del><ins>+                wp_die(); // require 2 chars for matching
</ins><span class="cx">
</span><span class="cx">         $results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.name LIKE (%s)", $taxonomy, '%' . like_escape( $s ) . '%' ) );
</span><span class="cx">
</span><span class="cx">         echo join( $results, "\n" );
</span><del>-        die;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_wp_compression_test() {
</span><span class="cx">         if ( !current_user_can( 'manage_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
</span><span class="cx">                 update_site_option('can_compress_scripts', 0);
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( isset($_GET['test']) ) {
</span><span class="lines">@@ -100,10 +100,10 @@
</span><span class="cx">
</span><span class="cx">                  if ( 1 == $_GET['test'] ) {
</span><span class="cx">                          echo $test_str;
</span><del>-                         die;
</del><ins>+                         wp_die();
</ins><span class="cx">                  } elseif ( 2 == $_GET['test'] ) {
</span><span class="cx">                         if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
</span><del>-                                die('-1');
</del><ins>+                                wp_die( -1 );
</ins><span class="cx">                         if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
</span><span class="cx">                                 header('Content-Encoding: deflate');
</span><span class="cx">                                 $out = gzdeflate( $test_str, 1 );
</span><span class="lines">@@ -111,10 +111,10 @@
</span><span class="cx">                                 header('Content-Encoding: gzip');
</span><span class="cx">                                 $out = gzencode( $test_str, 1 );
</span><span class="cx">                         } else {
</span><del>-                                die('-1');
</del><ins>+                                wp_die( -1 );
</ins><span class="cx">                         }
</span><span class="cx">                         echo $out;
</span><del>-                        die;
</del><ins>+                        wp_die();
</ins><span class="cx">                 } elseif ( 'no' == $_GET['test'] ) {
</span><span class="cx">                         update_site_option('can_compress_scripts', 0);
</span><span class="cx">                 } elseif ( 'yes' == $_GET['test'] ) {
</span><span class="lines">@@ -122,28 +122,28 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        die('0');
</del><ins>+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_imgedit_preview() {
</span><span class="cx">         $post_id = intval($_GET['postid']);
</span><span class="cx">         if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( "image_editor-$post_id" );
</span><span class="cx">
</span><span class="cx">         include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
</span><span class="cx">         if ( ! stream_preview_image($post_id) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><del>-        die();
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_oembed_cache() {
</span><span class="cx">         global $wp_embed;
</span><span class="cx">
</span><span class="cx">         $return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0';
</span><del>-        die( $return );
</del><ins>+        wp_die( $return );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /*
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">         $url = esc_url_raw( @$_POST['_url'] );
</span><span class="cx">         // JS didn't send us everything we need to know. Just die with success message
</span><span class="cx">         if ( !$total || !$per_page || !$page || !$url )
</span><del>-                die( (string) time() );
</del><ins>+                wp_die( time() );
</ins><span class="cx">
</span><span class="cx">         $total += $delta;
</span><span class="cx">         if ( $total < 0 )
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx">         $taxonomy = get_taxonomy(substr($action, 4));
</span><span class="cx">         check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
</span><span class="cx">         if ( !current_user_can( $taxonomy->cap->edit_terms ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         $names = explode(',', $_POST['new'.$taxonomy->name]);
</span><span class="cx">         $parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
</span><span class="cx">         if ( 0 > $parent )
</span><span class="lines">@@ -295,9 +295,9 @@
</span><span class="cx">         $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
</span><span class="cx">
</span><span class="cx">         if ( !$comment = get_comment( $id ) )
</span><del>-                die( (string) time() );
</del><ins>+                wp_die( time() );
</ins><span class="cx">         if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( "delete-comment_$id" );
</span><span class="cx">         $status = wp_get_comment_status( $comment->comment_ID );
</span><span class="lines">@@ -305,33 +305,33 @@
</span><span class="cx">         $delta = -1;
</span><span class="cx">         if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
</span><span class="cx">                 if ( 'trash' == $status )
</span><del>-                        die( (string) time() );
</del><ins>+                        wp_die( time() );
</ins><span class="cx">                 $r = wp_trash_comment( $comment->comment_ID );
</span><span class="cx">         } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
</span><span class="cx">                 if ( 'trash' != $status )
</span><del>-                        die( (string) time() );
</del><ins>+                        wp_die( time() );
</ins><span class="cx">                 $r = wp_untrash_comment( $comment->comment_ID );
</span><span class="cx">                 if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash
</span><span class="cx">                         $delta = 1;
</span><span class="cx">         } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
</span><span class="cx">                 if ( 'spam' == $status )
</span><del>-                        die( (string) time() );
</del><ins>+                        wp_die( time() );
</ins><span class="cx">                 $r = wp_spam_comment( $comment->comment_ID );
</span><span class="cx">         } elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) {
</span><span class="cx">                 if ( 'spam' != $status )
</span><del>-                        die( (string) time() );
</del><ins>+                        wp_die( time() );
</ins><span class="cx">                 $r = wp_unspam_comment( $comment->comment_ID );
</span><span class="cx">                 if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam
</span><span class="cx">                         $delta = 1;
</span><span class="cx">         } elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) {
</span><span class="cx">                 $r = wp_delete_comment( $comment->comment_ID );
</span><span class="cx">         } else {
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
</span><span class="cx">                 _wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
</span><del>-        die( '0' );
</del><ins>+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_delete_tag() {
</span><span class="lines">@@ -342,16 +342,16 @@
</span><span class="cx">         $tax = get_taxonomy($taxonomy);
</span><span class="cx">
</span><span class="cx">         if ( !current_user_can( $tax->cap->delete_terms ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $tag = get_term( $tag_id, $taxonomy );
</span><span class="cx">         if ( !$tag || is_wp_error( $tag ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( wp_delete_term($tag_id, $taxonomy))
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         else
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_delete_link() {
</span><span class="lines">@@ -359,16 +359,16 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "delete-bookmark_$id" );
</span><span class="cx">         if ( !current_user_can( 'manage_links' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $link = get_bookmark( $id );
</span><span class="cx">         if ( !$link || is_wp_error( $link ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( wp_delete_link( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         else
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_delete_meta() {
</span><span class="lines">@@ -376,13 +376,13 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "delete-meta_$id" );
</span><span class="cx">         if ( !$meta = get_metadata_by_mid( 'post', $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $meta->post_id, $meta->meta_key ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         if ( delete_meta( $meta->meta_id ) )
</span><del>-                die('1');
-        die('0');
</del><ins>+                wp_die( 1 );
+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_delete_post( $action ) {
</span><span class="lines">@@ -390,15 +390,15 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "{$action}_$id" );
</span><span class="cx">         if ( !current_user_can( 'delete_post', $id ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( !get_post( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( wp_delete_post( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         else
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_trash_post( $action ) {
</span><span class="lines">@@ -406,10 +406,10 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "{$action}_$id" );
</span><span class="cx">         if ( !current_user_can( 'delete_post', $id ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( !get_post( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( 'trash-post' == $action )
</span><span class="cx">                 $done = wp_trash_post( $id );
</span><span class="lines">@@ -417,9 +417,9 @@
</span><span class="cx">                 $done = wp_untrash_post( $id );
</span><span class="cx">
</span><span class="cx">         if ( $done )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><del>-        die('0');
</del><ins>+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_untrash_post( $action ) {
</span><span class="lines">@@ -431,15 +431,15 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "{$action}_$id" );
</span><span class="cx">         if ( !current_user_can( 'delete_page', $id ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( !get_page( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         if ( wp_delete_post( $id ) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         else
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_dim_comment() {
</span><span class="lines">@@ -454,11 +454,11 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $current = wp_get_comment_status( $comment->comment_ID );
</span><span class="cx">         if ( $_POST['new'] == $current )
</span><del>-                die( (string) time() );
</del><ins>+                wp_die( time() );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( "approve-comment_$id" );
</span><span class="cx">         if ( in_array( $current, array( 'unapproved', 'spam' ) ) )
</span><span class="lines">@@ -476,13 +476,13 @@
</span><span class="cx">
</span><span class="cx">         // Decide if we need to send back '1' or a more complicated response including page links and comment counts
</span><span class="cx">         _wp_ajax_delete_comment_response( $comment->comment_ID );
</span><del>-        die( '0' );
</del><ins>+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_add_link_category( $action ) {
</span><span class="cx">         check_ajax_referer( $action );
</span><span class="cx">         if ( !current_user_can( 'manage_categories' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         $names = explode(',', $_POST['newcat']);
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">         foreach ( $names as $cat_name ) {
</span><span class="lines">@@ -516,7 +516,7 @@
</span><span class="cx">         $tax = get_taxonomy($taxonomy);
</span><span class="cx">
</span><span class="cx">         if ( !current_user_can( $tax->cap->edit_terms ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">
</span><span class="lines">@@ -567,20 +567,20 @@
</span><span class="cx">                 $taxonomy = sanitize_key( $_POST['tax'] );
</span><span class="cx">                 $tax = get_taxonomy( $taxonomy );
</span><span class="cx">                 if ( ! $tax )
</span><del>-                        die( '0' );
</del><ins>+                        wp_die( 0 );
</ins><span class="cx">                 if ( ! current_user_can( $tax->cap->assign_terms ) )
</span><del>-                        die( '-1' );
</del><ins>+                        wp_die( -1 );
</ins><span class="cx">         } else {
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
</span><span class="cx">
</span><span class="cx">         if ( empty( $tags ) )
</span><del>-                die( isset( $tax->no_tagcloud ) ? $tax->no_tagcloud : __('No tags found!') );
</del><ins>+                wp_die( isset( $tax->no_tagcloud ) ? $tax->no_tagcloud : __('No tags found!') );
</ins><span class="cx">
</span><span class="cx">         if ( is_wp_error( $tags ) )
</span><del>-                die( $tags->get_error_message() );
</del><ins>+                wp_die( $tags->get_error_message() );
</ins><span class="cx">
</span><span class="cx">         foreach ( $tags as $key => $tag ) {
</span><span class="cx">                 $tags[ $key ]->link = '#';
</span><span class="lines">@@ -591,11 +591,11 @@
</span><span class="cx">         $return = wp_generate_tag_cloud( $tags, array('filter' => 0) );
</span><span class="cx">
</span><span class="cx">         if ( empty($return) )
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         echo $return;
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_get_comments( $action ) {
</span><span class="lines">@@ -608,12 +608,12 @@
</span><span class="cx">         $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
</span><span class="cx">
</span><span class="cx">         if ( !current_user_can( 'edit_post', $post_id ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $wp_list_table->prepare_items();
</span><span class="cx">
</span><span class="cx">         if ( !$wp_list_table->has_items() )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         $x = new WP_Ajax_Response();
</span><span class="cx">         ob_start();
</span><span class="lines">@@ -642,14 +642,14 @@
</span><span class="cx">
</span><span class="cx">         $comment_post_ID = (int) $_POST['comment_post_ID'];
</span><span class="cx">         if ( !current_user_can( 'edit_post', $comment_post_ID ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
</span><span class="cx">
</span><span class="cx">         if ( empty($status) )
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         elseif ( in_array($status, array('draft', 'pending', 'trash') ) )
</span><del>-                die( __('ERROR: you are replying to a comment on a draft post.') );
</del><ins>+                wp_die( __('ERROR: you are replying to a comment on a draft post.') );
</ins><span class="cx">
</span><span class="cx">         $user = wp_get_current_user();
</span><span class="cx">         if ( $user->ID ) {
</span><span class="lines">@@ -664,11 +664,11 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><del>-                die( __('Sorry, you must be logged in to reply to a comment.') );
</del><ins>+                wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( '' == $comment_content )
</span><del>-                die( __('ERROR: please type a comment.') );
</del><ins>+                wp_die( __( 'ERROR: please type a comment.' ) );
</ins><span class="cx">
</span><span class="cx">         $comment_parent = absint($_POST['comment_ID']);
</span><span class="cx">         $comment_auto_approved = false;
</span><span class="lines">@@ -676,7 +676,7 @@
</span><span class="cx">
</span><span class="cx">         $comment_id = wp_new_comment( $commentdata );
</span><span class="cx">         $comment = get_comment($comment_id);
</span><del>-        if ( ! $comment ) die('1');
</del><ins>+        if ( ! $comment ) wp_die( 1 );
</ins><span class="cx">
</span><span class="cx">         $position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
</span><span class="cx">
</span><span class="lines">@@ -729,10 +729,10 @@
</span><span class="cx">
</span><span class="cx">         $comment_id = (int) $_POST['comment_ID'];
</span><span class="cx">         if ( ! current_user_can( 'edit_comment', $comment_id ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( '' == $_POST['content'] )
</span><del>-                die( __('ERROR: please type a comment.') );
</del><ins>+                wp_die( __( 'ERROR: please type a comment.' ) );
</ins><span class="cx">
</span><span class="cx">         $_POST['comment_status'] = $_POST['status'];
</span><span class="cx">         edit_comment();
</span><span class="lines">@@ -764,7 +764,7 @@
</span><span class="cx">
</span><span class="cx"> function wp_ajax_add_menu_item() {
</span><span class="cx">         if ( ! current_user_can( 'edit_theme_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
</span><span class="cx">
</span><span class="lines">@@ -802,7 +802,7 @@
</span><span class="cx">
</span><span class="cx">         $item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
</span><span class="cx">         if ( is_wp_error( $item_ids ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $menu_items = array();
</span><span class="cx">
</span><span class="lines">@@ -835,9 +835,9 @@
</span><span class="cx">
</span><span class="cx">         if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
</span><span class="cx">                 if ( !current_user_can( 'edit_post', $pid ) )
</span><del>-                        die('-1');
</del><ins>+                        wp_die( -1 );
</ins><span class="cx">                 if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
</span><del>-                        die('1');
</del><ins>+                        wp_die( 1 );
</ins><span class="cx">                 if ( $post->post_status == 'auto-draft' ) {
</span><span class="cx">                         $save_POST = $_POST; // Backup $_POST
</span><span class="cx">                         $_POST = array(); // Make it empty for edit_post()
</span><span class="lines">@@ -858,12 +858,12 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 $_POST = $save_POST; // Now we can restore original $_POST again
</span><span class="cx">                                 if ( !$mid = add_meta( $pid ) )
</span><del>-                                        die(__('Please provide a custom field value.'));
</del><ins>+                                        wp_die( __( 'Please provide a custom field value.' ) );
</ins><span class="cx">                         } else {
</span><del>-                                die('0');
</del><ins>+                                wp_die( 0 );
</ins><span class="cx">                         }
</span><span class="cx">                 } else if ( !$mid = add_meta( $pid ) ) {
</span><del>-                        die(__('Please provide a custom field value.'));
</del><ins>+                        wp_die( __( 'Please provide a custom field value.' ) );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $meta = get_metadata_by_mid( 'post', $mid );
</span><span class="lines">@@ -881,18 +881,18 @@
</span><span class="cx">                 $key = stripslashes( $_POST['meta'][$mid]['key'] );
</span><span class="cx">                 $value = stripslashes( $_POST['meta'][$mid]['value'] );
</span><span class="cx">                 if ( '' == trim($key) )
</span><del>-                        die(__('Please provide a custom field name.'));
</del><ins>+                        wp_die( __( 'Please provide a custom field name.' ) );
</ins><span class="cx">                 if ( '' == trim($value) )
</span><del>-                        die(__('Please provide a custom field value.'));
</del><ins>+                        wp_die( __( 'Please provide a custom field value.' ) );
</ins><span class="cx">                 if ( ! $meta = get_metadata_by_mid( 'post', $mid ) )
</span><del>-                        die('0'); // if meta doesn't exist
</del><ins>+                        wp_die( 0 ); // if meta doesn't exist
</ins><span class="cx">                 if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
</span><span class="cx">                         ! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) ||
</span><span class="cx">                         ! current_user_can( 'edit_post_meta', $meta->post_id, $key ) )
</span><del>-                        die('-1');
</del><ins>+                        wp_die( -1 );
</ins><span class="cx">                 if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
</span><span class="cx">                         if ( !$u = update_metadata_by_mid( 'post', $mid, $value, $key ) )
</span><del>-                                die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
</del><ins>+                                wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $x = new WP_Ajax_Response( array(
</span><span class="lines">@@ -915,9 +915,9 @@
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( $action );
</span><span class="cx">         if ( ! current_user_can('create_users') )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         if ( ! $user_id = edit_user() ) {
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         } elseif ( is_wp_error( $user_id ) ) {
</span><span class="cx">                 $x = new WP_Ajax_Response( array(
</span><span class="cx">                         'what' => 'user',
</span><span class="lines">@@ -986,10 +986,10 @@
</span><span class="cx">
</span><span class="cx">         if ( 'page' == $post->post_type ) {
</span><span class="cx">                 if ( !current_user_can('edit_page', $post_ID) )
</span><del>-                        die(__('You are not allowed to edit this page.'));
</del><ins>+                        wp_die( __( 'You are not allowed to edit this page.' ) );
</ins><span class="cx">         } else {
</span><span class="cx">                 if ( !current_user_can('edit_post', $post_ID) )
</span><del>-                        die(__('You are not allowed to edit this post.'));
</del><ins>+                        wp_die( __( 'You are not allowed to edit this post.' ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( $do_autosave ) {
</span><span class="lines">@@ -1053,10 +1053,10 @@
</span><span class="cx">         $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx">
</span><span class="cx">         if ( $page != sanitize_key( $page ) )
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         if ( ! $user = wp_get_current_user() )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( is_array($closed) )
</span><span class="cx">                 update_user_option($user->ID, "closedpostboxes_$page", $closed, true);
</span><span class="lines">@@ -1066,7 +1066,7 @@
</span><span class="cx">                 update_user_option($user->ID, "metaboxhidden_$page", $hidden, true);
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        die('1');
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_hidden_columns() {
</span><span class="lines">@@ -1076,31 +1076,31 @@
</span><span class="cx">         $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx">
</span><span class="cx">         if ( $page != sanitize_key( $page ) )
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         if ( ! $user = wp_get_current_user() )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( is_array($hidden) )
</span><span class="cx">                 update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
</span><span class="cx">
</span><del>-        die('1');
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_update_welcome_panel() {
</span><span class="cx">         check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' );
</span><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'edit_theme_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 );
</span><span class="cx">
</span><del>-        die('1');
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_menu_get_metabox() {
</span><span class="cx">         if ( ! current_user_can( 'edit_theme_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
</span><span class="cx">
</span><span class="lines">@@ -1135,7 +1135,7 @@
</span><span class="cx">                 ));
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_wp_link_ajax() {
</span><span class="lines">@@ -1151,22 +1151,22 @@
</span><span class="cx">         $results = _WP_Editors::wp_link_query( $args );
</span><span class="cx">
</span><span class="cx">         if ( ! isset( $results ) )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         echo json_encode( $results );
</span><span class="cx">         echo "\n";
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_menu_locations_save() {
</span><span class="cx">         if ( ! current_user_can( 'edit_theme_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
</span><span class="cx">         if ( ! isset( $_POST['menu-locations'] ) )
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
</span><del>-        die('1');
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_meta_box_order() {
</span><span class="lines">@@ -1180,10 +1180,10 @@
</span><span class="cx">         $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx">
</span><span class="cx">         if ( $page != sanitize_key( $page ) )
</span><del>-                die('0');
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         if ( ! $user = wp_get_current_user() )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         if ( $order )
</span><span class="cx">                 update_user_option($user->ID, "meta-box-order_$page", $order, true);
</span><span class="lines">@@ -1191,24 +1191,24 @@
</span><span class="cx">         if ( $page_columns )
</span><span class="cx">                 update_user_option($user->ID, "screen_layout_$page", $page_columns, true);
</span><span class="cx">
</span><del>-        die('1');
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_menu_quick_search() {
</span><span class="cx">         if ( ! current_user_can( 'edit_theme_options' ) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
</span><span class="cx">
</span><span class="cx">         _wp_ajax_menu_quick_search( $_POST );
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_get_permalink() {
</span><span class="cx">         check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
</span><span class="cx">         $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
</span><del>-        die(add_query_arg(array('preview' => 'true'), get_permalink($post_id)));
</del><ins>+        wp_die( add_query_arg( array( 'preview' => 'true' ), get_permalink( $post_id ) ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_sample_permalink() {
</span><span class="lines">@@ -1216,7 +1216,7 @@
</span><span class="cx">         $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
</span><span class="cx">         $title = isset($_POST['new_title'])? $_POST['new_title'] : '';
</span><span class="cx">         $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
</span><del>-        die(get_sample_permalink_html($post_id, $title, $slug));
</del><ins>+        wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_inline_save() {
</span><span class="lines">@@ -1225,14 +1225,14 @@
</span><span class="cx">         check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
</span><span class="cx">
</span><span class="cx">         if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
</span><del>-                exit;
</del><ins>+                wp_die();
</ins><span class="cx">
</span><span class="cx">         if ( 'page' == $_POST['post_type'] ) {
</span><span class="cx">                 if ( ! current_user_can( 'edit_page', $post_ID ) )
</span><del>-                        die( __('You are not allowed to edit this page.') );
</del><ins>+                        wp_die( __( 'You are not allowed to edit this page.' ) );
</ins><span class="cx">         } else {
</span><span class="cx">                 if ( ! current_user_can( 'edit_post', $post_ID ) )
</span><del>-                        die( __('You are not allowed to edit this post.') );
</del><ins>+                        wp_die( __( 'You are not allowed to edit this post.' ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         set_current_screen( $_POST['screen'] );
</span><span class="lines">@@ -1241,7 +1241,7 @@
</span><span class="cx">                 $last_user = get_userdata( $last );
</span><span class="cx">                 $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
</span><span class="cx">                 printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),        esc_html( $last_user_name ) );
</span><del>-                exit;
</del><ins>+                wp_die();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $data = &$_POST;
</span><span class="lines">@@ -1277,7 +1277,7 @@
</span><span class="cx">         $mode = $_POST['post_view'];
</span><span class="cx">         $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) );
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_inline_save_tax() {
</span><span class="lines">@@ -1288,17 +1288,17 @@
</span><span class="cx">         $taxonomy = sanitize_key( $_POST['taxonomy'] );
</span><span class="cx">         $tax = get_taxonomy( $taxonomy );
</span><span class="cx">         if ( ! $tax )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         if ( ! current_user_can( $tax->cap->edit_terms ) )
</span><del>-                die( '-1' );
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         set_current_screen( 'edit-' . $taxonomy );
</span><span class="cx">
</span><span class="cx">         $wp_list_table = _get_list_table('WP_Terms_List_Table');
</span><span class="cx">
</span><span class="cx">         if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
</span><del>-                die(-1);
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $tag = get_term( $id, $taxonomy );
</span><span class="cx">         $_POST['description'] = $tag->description;
</span><span class="lines">@@ -1308,18 +1308,18 @@
</span><span class="cx">                 $tag = get_term( $updated['term_id'], $taxonomy );
</span><span class="cx">                 if ( !$tag || is_wp_error( $tag ) ) {
</span><span class="cx">                         if ( is_wp_error($tag) && $tag->get_error_message() )
</span><del>-                                die( $tag->get_error_message() );
-                        die( __('Item not updated.') );
</del><ins>+                                wp_die( $tag->get_error_message() );
+                        wp_die( __( 'Item not updated.' ) );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 echo $wp_list_table->single_row( $tag );
</span><span class="cx">         } else {
</span><span class="cx">                 if ( is_wp_error($updated) && $updated->get_error_message() )
</span><del>-                        die( $updated->get_error_message() );
-                die( __('Item not updated.') );
</del><ins>+                        wp_die( $updated->get_error_message() );
+                wp_die( __( 'Item not updated.' ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        exit;
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_find_posts() {
</span><span class="lines">@@ -1328,7 +1328,7 @@
</span><span class="cx">         check_ajax_referer( 'find-posts' );
</span><span class="cx">
</span><span class="cx">         if ( empty($_POST['ps']) )
</span><del>-                exit;
</del><ins>+                wp_die();
</ins><span class="cx">
</span><span class="cx">         if ( !empty($_POST['post_type']) && in_array( $_POST['post_type'], get_post_types() ) )
</span><span class="cx">                 $what = $_POST['post_type'];
</span><span class="lines">@@ -1353,7 +1353,7 @@
</span><span class="cx">
</span><span class="cx">         if ( ! $posts ) {
</span><span class="cx">                 $posttype = get_post_type_object($what);
</span><del>-                exit($posttype->labels->not_found);
</del><ins>+                wp_die( $posttype->labels->not_found );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Date').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
</span><span class="lines">@@ -1400,7 +1400,7 @@
</span><span class="cx">         check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
</span><span class="cx">
</span><span class="cx">         if ( !current_user_can('edit_theme_options') )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         unset( $_POST['savewidgets'], $_POST['action'] );
</span><span class="cx">
</span><span class="lines">@@ -1421,10 +1421,10 @@
</span><span class="cx">                         $sidebars[$key] = $sb;
</span><span class="cx">                 }
</span><span class="cx">                 wp_set_sidebars_widgets($sidebars);
</span><del>-                die('1');
</del><ins>+                wp_die( 1 );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        die('-1');
</del><ins>+        wp_die( -1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_save_widget() {
</span><span class="lines">@@ -1433,7 +1433,7 @@
</span><span class="cx">         check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
</span><span class="cx">
</span><span class="cx">         if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         unset( $_POST['savewidgets'], $_POST['action'] );
</span><span class="cx">
</span><span class="lines">@@ -1455,13 +1455,13 @@
</span><span class="cx">         if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
</span><span class="cx">
</span><span class="cx">                 if ( !isset($wp_registered_widgets[$widget_id]) )
</span><del>-                        die($error);
</del><ins>+                        wp_die( $error );
</ins><span class="cx">
</span><span class="cx">                 $sidebar = array_diff( $sidebar, array($widget_id) );
</span><span class="cx">                 $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
</span><span class="cx">         } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) {
</span><span class="cx">                 if ( !$multi_number )
</span><del>-                        die($error);
</del><ins>+                        wp_die( $error );
</ins><span class="cx">
</span><span class="cx">                 $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) );
</span><span class="cx">                 $widget_id = $id_base . '-' . $multi_number;
</span><span class="lines">@@ -1486,22 +1486,22 @@
</span><span class="cx">                 $sidebars[$sidebar_id] = $sidebar;
</span><span class="cx">                 wp_set_sidebars_widgets($sidebars);
</span><span class="cx">                 echo "deleted:$widget_id";
</span><del>-                die();
</del><ins>+                wp_die();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( !empty($_POST['add_new']) )
</span><del>-                die();
</del><ins>+                wp_die();
</ins><span class="cx">
</span><span class="cx">         if ( $form = $wp_registered_widget_controls[$widget_id] )
</span><span class="cx">                 call_user_func_array( $form['callback'], $form['params'] );
</span><span class="cx">
</span><del>-        die();
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_image_editor() {
</span><span class="cx">         $attachment_id = intval($_POST['postid']);
</span><span class="cx">         if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) )
</span><del>-                die('-1');
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( "image_editor-$attachment_id" );
</span><span class="cx">         include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
</span><span class="lines">@@ -1511,7 +1511,7 @@
</span><span class="cx">                 case 'save' :
</span><span class="cx">                         $msg = wp_save_image($attachment_id);
</span><span class="cx">                         $msg = json_encode($msg);
</span><del>-                        die($msg);
</del><ins>+                        wp_die( $msg );
</ins><span class="cx">                         break;
</span><span class="cx">                 case 'scale' :
</span><span class="cx">                         $msg = wp_save_image($attachment_id);
</span><span class="lines">@@ -1522,35 +1522,35 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         wp_image_editor($attachment_id, $msg);
</span><del>-        die();
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_set_post_thumbnail() {
</span><span class="cx">         $post_ID = intval( $_POST['post_id'] );
</span><span class="cx">         if ( !current_user_can( 'edit_post', $post_ID ) )
</span><del>-                die( '-1' );
</del><ins>+                wp_die( -1 );
</ins><span class="cx">         $thumbnail_id = intval( $_POST['thumbnail_id'] );
</span><span class="cx">
</span><span class="cx">         check_ajax_referer( "set_post_thumbnail-$post_ID" );
</span><span class="cx">
</span><span class="cx">         if ( $thumbnail_id == '-1' ) {
</span><span class="cx">                 if ( delete_post_thumbnail( $post_ID ) )
</span><del>-                        die( _wp_post_thumbnail_html() );
</del><ins>+                        wp_die( _wp_post_thumbnail_html() );
</ins><span class="cx">                 else
</span><del>-                        die( '0' );
</del><ins>+                        wp_die( 0 );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( set_post_thumbnail( $post_ID, $thumbnail_id ) )
</span><del>-                die( _wp_post_thumbnail_html( $thumbnail_id ) );
-        die( '0' );
</del><ins>+                wp_die( _wp_post_thumbnail_html( $thumbnail_id ) );
+        wp_die( 0 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_date_format() {
</span><del>-        die( date_i18n( sanitize_option( 'date_format', $_POST['date'] ) ) );
</del><ins>+        wp_die( date_i18n( sanitize_option( 'date_format', $_POST['date'] ) ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_time_format() {
</span><del>-        die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
</del><ins>+        wp_die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_wp_fullscreen_save_post() {
</span><span class="lines">@@ -1577,7 +1577,7 @@
</span><span class="cx">                         $message = __('Save failed');
</span><span class="cx">
</span><span class="cx">                 echo json_encode( array( 'message' => $message, 'last_edited' => '' ) );
</span><del>-                die();
</del><ins>+                wp_die();
</ins><span class="cx">         } else {
</span><span class="cx">                 $message = __('Saved.');
</span><span class="cx">         }
</span><span class="lines">@@ -1598,45 +1598,45 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
</span><del>-        die();
</del><ins>+        wp_die();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_wp_remove_post_lock() {
</span><span class="cx">         if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">         $post_id = (int) $_POST['post_ID'];
</span><span class="cx">         if ( ! $post = get_post( $post_id ) )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         check_ajax_referer( 'update-' . $post->post_type . '_' . $post_id );
</span><span class="cx">
</span><span class="cx">         if ( ! current_user_can( 'edit_post', $post_id ) )
</span><del>-                die( '-1' );
</del><ins>+                wp_die( -1 );
</ins><span class="cx">
</span><span class="cx">         $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
</span><span class="cx">         if ( $active_lock[1] != get_current_user_id() )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         $new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 ) + 5 ) . ':' . $active_lock[1];
</span><span class="cx">         update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
</span><del>-        die( '1' );
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_ajax_dismiss_wp_pointer() {
</span><span class="cx">         $pointer = $_POST['pointer'];
</span><span class="cx">         if ( $pointer != sanitize_key( $pointer ) )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx"> //        check_ajax_referer( 'dismiss-pointer_' . $pointer );
</span><span class="cx">
</span><span class="cx">         $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
</span><span class="cx">
</span><span class="cx">         if ( in_array( $pointer, $dismissed ) )
</span><del>-                die( '0' );
</del><ins>+                wp_die( 0 );
</ins><span class="cx">
</span><span class="cx">         $dismissed[] = $pointer;
</span><span class="cx">         $dismissed = implode( ',', $dismissed );
</span><span class="cx">
</span><span class="cx">         update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
</span><del>-        die( '1' );
</del><ins>+        wp_die( 1 );
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>